Retired

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.

Algorithms

Similar Kata:

More By Author:

Check out these other kata created by joseph.varnado

Stats:

CreatedOct 29, 2013
Warriors Trained217
Total Skips58
Total Code Submissions1159
Total Times Completed76
JavaScript Completions69
Total Stars4
% of votes with a positive feedback rating72% of 32
Total "Very Satisfied" Votes21
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes6
Total Rank Assessments43
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • joseph.varnado Avatar
Ad