Created
February 13, 2016 00:12
-
-
Save DinnerFingers/5831d4f6f26f27028b7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet" <--this is the only one with no check (-.-) | |
Cards Sequence 7, 8, 9 should return "0 Hold" | |
Cards Sequence 10, J, Q, K, A should return "-5 Hold" | |
Cards Sequence 3, 2, A, 10, K should return "-1 Hold" | |
*/ | |
var count = 0; | |
function cc(card) { | |
// Only change code below this line | |
switch (card) { | |
case 2: (count ++); | |
break; | |
case 3: (count ++); | |
break; | |
case 4: (count ++); | |
break; | |
case 5: (count ++); | |
break; | |
case 6: (count ++); | |
break; | |
case 7: (count = 0); | |
break; | |
case 8: (count = 0); | |
break; | |
case 9: (count = 0); | |
break; | |
case 10: (count --); | |
break; | |
case "J": (count --); | |
break; | |
case "Q": (count --); | |
break; | |
case "K": (count --); | |
break; | |
case "A": (count --); | |
break; | |
} | |
if (count <= 0); { | |
return count + " Hold"; | |
} | |
if (count >= 1);{ | |
return count + " Bet"; | |
} | |
// Only change code above this line | |
} | |
// Add/remove calls to test your function. | |
// Note: Only the last will display | |
cc(2); cc(3); cc(4); cc(5); cc(6); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment