$24
In this assignment, you will be required to use JavaScript to complete a simple Black Jack game.
Black Jack is a simple card game that is also often called 21. The point of the game is to get a value as close to 21 without going over. A player that obtains the score of 21 with only 2 cards is said to have a Black Jack.
Rules of the game:
There are 2 types of participants in a game of Black Jack, the dealer and the players. The players play against the dealer and not against each other. In order to win, the player must have a hand value superior to that of the dealer’s.
The game starts with each player receiving 2 cards, the dealer receiving 2 cards. Each player has the option to add an additional cards (1 by 1) to his hand (Draw) or to stay with the cards he currently has (Hold). If at any point, the player’s total exceeds 21, he automatically loses the hand (Bust).
When all players complete this process, the dealer gets to complete his hand. As long as the dealer’s point total is 16 or less, he must draw a new card. As soon as the dealer’s hand reaches the value of 17 or more, he must remain with the current hand. If the dealer’s hand exceeds 21, the players still participating in the hand (those that did not Bust) automatically win.
Assignment:
This game will be a simplified version of the traditional game:
• Only 1 player and a dealer
• Aces count as the value 11 at all times
The following specifications are required for successfully completing this assignment:
1. When the document loads, both the dealer and the player must have 2 random cards
a. Duplicate cards in a single hand are not permitted
2. Each hand starts with a blank slate, no data passes from 1 hand to the next
3. The scores of each participants must be updated in the “dealerScore” and “playerScore” sections
4. The “Draw 1 more Card” button must allow the player to draw an additional card
a. If the player’s score is currently at 21 or higher, this button must become disabled
i. The hold button must also become disabled
5. The “Hold” button concludes the player’s actions and triggers the completion of the dealer’s hand as per the rules of the game.
a. This button must become disabled
b. The “Draw 1 more Card” button must also become disabled
6. The hand ends at the conclusion of the dealer’s turn
7. The scores are compared
a. The winner is identified by adding the statement “has won the hand” to the current identification of the winning participant
b. The winner’s identification should also be highlighted in green