Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 2 Black Jack DO NOT USE JQUERY PLEASE! ONLY JAVASCRIPT In this assignment, you will be required to use JavaScript to complete a simple

Assignment 2 Black Jack

DO NOT USE JQUERY PLEASE! ONLY JAVASCRIPT

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 dealers.

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 players total exceeds 21, he automatically loses the hand (Bust).

When all players complete this process, the dealer get to complete his hand. As long as the dealers point total is 16 or less, he must draw a new card. As soon as the dealers hand reaches the value of 17 or more, he must remain with the current hand. If the dealers hand exceeds 21, the players still participating in the hand 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. The Start a new Game button must refresh the entire game and all its content
  2. When the document loads, both the dealer and the player must have random 2 cards
    1. Duplicate cards in a single hand are not permitted
  3. Each hand starts with a blank slate, no data passes from 1 hand to the next
  4. The scores of each participants must be updated in the dealerScore and playerScore sections
  5. The Draw 1 more Card button must allow the player to draw an additional card
    1. If the players score is currently at 21 or higher, this button must become disabled
      1. The hold button must also become disabled
  6. The Hold button concludes the players actions and triggers the completion of the dealers hand as per the rules of the game.
    1. This button must become disabled
    2. The Draw 1 more Card button must also become disabled
  7. The hand ends at the conclusion of the dealers turn
  8. The scores are compared
    1. The winner is identified by adding the statement has won the hand to the current identification of the winning participant
    2. The winners identification should also be highlighted in green

ONLY JAVASCRIPT, NO JQUERY PLEASE!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

Explain the forces that influence how people handle conflict

Answered: 1 week ago