BLACKJACK DO not use jquery strictly java script 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.

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (MindTap Course List)
1st Edition
ISBN:9781305657458
Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Chapter7: Input And Output: Extending Capabilities Of Computers And Mobile Devices
Section: Chapter Questions
Problem 10CT
icon
Related questions
Question

BLACKJACK

DO not use jquery strictly java script

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
    1. 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
    1. If the player’s score is currently at 21 or higher, this button must become disabled
      1. The hold button must also become disabled
    2. The “Hold” button concludes the player’s actions and triggers the completion of the dealer’s 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
    3. The hand ends at the conclusion of the dealer’s turn
    4. 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 winner’s identification should also be highlighted in green

The images are the html code that was used, so you can implement the javascript code

<!DOCTYPE html:
3 <html>
- <head>
<script src="game.js"></script>
<style>
table{
margin:auto;
width:100% ;
tr.spacer{
height:55px;
div#header{
width: 100%;
text-align: right;
div#wrapper{
/*border: solid red 1px;*/
width: 750px;
margin:auto;
text-align: center;
div.dealer, div.player{
float:left;
background-image:url ("cards.png");
width:74px;
height:99px;
/* move 1 card right is -73px */
/* move 1 card down is -98px */
background-position:Opx Opx ;
margin-left:15px;
margin-right:15px;
img{
width:214px;
height:196px;
input [type='button'] {
width: 201px;
height:75px;
background-color : #4CAF50;
text-align:center;
margin: 25px;
}
input#reload{
margin: 7px 35рх;
Transcribed Image Text:<!DOCTYPE html: 3 <html> - <head> <script src="game.js"></script> <style> table{ margin:auto; width:100% ; tr.spacer{ height:55px; div#header{ width: 100%; text-align: right; div#wrapper{ /*border: solid red 1px;*/ width: 750px; margin:auto; text-align: center; div.dealer, div.player{ float:left; background-image:url ("cards.png"); width:74px; height:99px; /* move 1 card right is -73px */ /* move 1 card down is -98px */ background-position:Opx Opx ; margin-left:15px; margin-right:15px; img{ width:214px; height:196px; input [type='button'] { width: 201px; height:75px; background-color : #4CAF50; text-align:center; margin: 25px; } input#reload{ margin: 7px 35рх;
</style>
F</head>
<body onload="deal () ;">
<div id="header">
<input id="reload" type = "button" value="Start a new Game" onclick="location.reload () ;">
</div>
<div id="wrapper">
<table border=0 id="blackjacktable">
<tr class="spacer"></tr>
<tr>
<th id="dealerLabel" colspan=2 >Dealer
</th>
</tr>
<tr>
<th colspan=2 id="dealerScore"></th>
</tr>
くtr>
<td id="dealerHand">
<img id="dealer1" src="" width="107" height="98">
<img id="dealer2" src="" width="107" height="98">
</td>
</tr>
<tr class="spacer"></tr>
<tr>
<th id="playerLabel" colspan=2>Player
</th>
</tr>
<tr>
<th colspan=2 id="playerScore"></th>
</tr>
くtr>
<td>
<input id="btnDraw" type="button" onclick="requestPlayerCard () ;" value="Draw 1 more Card">
<input id="btnHold" type="button" onclick="completeDealerHand () ;" value="Hold">
</td>
</tr>
くtr>
<td id="playerHand">
<img id="playerl" src="" width="107" height="98">
<img id="player2" src="" width="107" height="98">
</td>
</tr>
</table>
</div>
</body>
</html>
Transcribed Image Text:</style> F</head> <body onload="deal () ;"> <div id="header"> <input id="reload" type = "button" value="Start a new Game" onclick="location.reload () ;"> </div> <div id="wrapper"> <table border=0 id="blackjacktable"> <tr class="spacer"></tr> <tr> <th id="dealerLabel" colspan=2 >Dealer </th> </tr> <tr> <th colspan=2 id="dealerScore"></th> </tr> くtr> <td id="dealerHand"> <img id="dealer1" src="" width="107" height="98"> <img id="dealer2" src="" width="107" height="98"> </td> </tr> <tr class="spacer"></tr> <tr> <th id="playerLabel" colspan=2>Player </th> </tr> <tr> <th colspan=2 id="playerScore"></th> </tr> くtr> <td> <input id="btnDraw" type="button" onclick="requestPlayerCard () ;" value="Draw 1 more Card"> <input id="btnHold" type="button" onclick="completeDealerHand () ;" value="Hold"> </td> </tr> くtr> <td id="playerHand"> <img id="playerl" src="" width="107" height="98"> <img id="player2" src="" width="107" height="98"> </td> </tr> </table> </div> </body> </html>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Enhanced Discovering Computers 2017 (Shelly Cashm…
Enhanced Discovering Computers 2017 (Shelly Cashm…
Computer Science
ISBN:
9781305657458
Author:
Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:
Cengage Learning