Card Counting
Description:
In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting.
Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.
Count Change: Cards:
+1: 2, 3, 4, 5, 6
0: 7, 8, 9
-1: 10, 'J', 'Q', 'K', 'A'
You will write a card counting function. It will receive a card parameter and increment or decrement the local 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 Hold"
"5 Bet"
Similar Kata:
Stats:
Created | Dec 4, 2016 |
Published | Dec 4, 2016 |
Warriors Trained | 271 |
Total Skips | 40 |
Total Code Submissions | 173 |
Total Times Completed | 85 |
JavaScript Completions | 84 |
Total Stars | 5 |
% of votes with a positive feedback rating | 84% of 45 |
Total "Very Satisfied" Votes | 34 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 47 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |