Blackjack Winner (retired)
Description:
Blackjack:
The object of the game is to "beat the dealer", which can be done in a number of ways:
-Get 21 points on your first two cards (called a blackjack), without a dealer blackjack;
-Reach a final score higher than the dealer without exceeding 21; or
-Let the dealer draw additional cards until his hand exceeds 21.
http://en.wikipedia.org/wiki/Blackjack
Complete the GetWinner() function so that it takes in 2 Player() Objects then returns a String equal to the name of the player that won.
Usage:
dealer = new Player('Phillip', [7, 9]);
player = new Player('Brandon', [10, 11]);
GetWinner(player, dealer) -> 'Brandon'
The cards are an Array of numbers and can be accessed using the Player.cards property.
2-9 represents cards 2-9.
10 represents cards J, Q, K
11 OR 1 represents the Ace card.
If a player's cards total more than 21 and the player has at least one Ace in their hand, the value of the Ace is changed to 1.
House Rules:
If the dealer and player tie, the dealer wins.
If the dealer's and player's card total is greater than 21, the dealer wins.
Similar Kata:
Stats:
Created | Oct 29, 2013 |
Warriors Trained | 217 |
Total Skips | 58 |
Total Code Submissions | 1159 |
Total Times Completed | 76 |
JavaScript Completions | 69 |
Total Stars | 4 |
% of votes with a positive feedback rating | 72% of 32 |
Total "Very Satisfied" Votes | 21 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 6 |
Total Rank Assessments | 43 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |