Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Card Counting
- // @m4sterbunny
- // Card Counting, can I use Switch for this? sure! (or an if/else statement)
- var count = 0;
- function cc(card) {
- // Only change code below this line
- switch (count) {
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- count += count; <!-- ok, here. is this what we want? the count needs to increment by one (1)
- if any of these cases are met. -->
- break;
- case 7:
- case 8:
- case 9:
- count = count +0; <!-- don't really need a count statement, as there is no change for these cases. -->
- break;
- case 10:
- case "J":
- case "Q":
- case "K":
- case "A":
- count -= count; <!-- again, we need to ensure we make the correct change for these cases. for these,
- the count should decrease by one (1).
- break;
- }
- if (count > 0) {
- return ("count" " Bet");
- }
- else if (count <= 0) {
- return ["count" " Hold"];
- }
- // Only change code above this line
- }
- // Add/remove calls to test your function.
- // Note: Only the last will display
- cc(2); cc(3); cc(7); cc('K'); cc('A');
Add Comment
Please, Sign In to add comment