| Count Change | Cards |
|---|---|
| +1 | 2, 3, 4, 5, 6 |
| 0 | 7, 8, 9 |
| -1 | 10, 'J', 'Q', 'K', 'A' |
card parameter, which can be a number or a string, and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string Bet if the count is positive, or Hold if the count is zero or negative. The current count and the player's decision (Bet or Hold) should be separated by a single space.
Example Output-3 Hold5 Bet
Hintcount to 0 when value is 7, 8, or 9.5 Bet
testString: assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })(), 'Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet');
- text: Cards Sequence 7, 8, 9 should return 0 Hold
testString: assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })(), 'Cards Sequence 7, 8, 9 should return 0 Hold');
- text: Cards Sequence 10, J, Q, K, A should return -5 Hold
testString: assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === "-5 Hold") {return true;} return false; })(), 'Cards Sequence 10, J, Q, K, A should return -5 Hold');
- text: Cards Sequence 3, 7, Q, 8, A should return -1 Hold
testString: assert((function(){ count = 0; cc(3);cc(7);cc('Q');cc(8);var out = cc('A'); if(out === "-1 Hold") {return true;} return false; })(), 'Cards Sequence 3, 7, Q, 8, A should return -1 Hold');
- text: Cards Sequence 2, J, 9, 2, 7 should return 1 Bet
testString: assert((function(){ count = 0; cc(2);cc('J');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })(), 'Cards Sequence 2, J, 9, 2, 7 should return 1 Bet');
- text: Cards Sequence 2, 2, 10 should return 1 Bet
testString: assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })(), 'Cards Sequence 2, 2, 10 should return 1 Bet');
- text: Cards Sequence 3, 2, A, 10, K should return -1 Hold
testString: assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === "-1 Hold") {return true;} return false; })(), 'Cards Sequence 3, 2, A, 10, K should return -1 Hold');
```