Question
************************************************************************************************* OPTION 1: Magic13 Dice Game (the simpler game to code) Javascript programming Language ************************************************************************************************* Design and code a program called Magic13 that is a
*************************************************************************************************
OPTION 1: Magic13 Dice Game (the simpler game to code) Javascript programming Language
*************************************************************************************************
Design and code a program called Magic13 that is a dice game played between 2 human players.
The overall goal of the game is to be the first to get to 50 or more total points. If both players go over 50 points at the same time, the player with the most points wins (or it is a tie if they have equal points).
The goal in each round is to get the closest to 13 points. In the case of a tie, both players get 0 points for the round.
Here is how 1 round of the game works:
Player 1 is asked if they want to roll 1 or 2 dice. If they roll 1 die, they get the number of points that they rolled (e.g. if they roll a 4 they get 4 points). If they roll 2 dice, the following scoring rules apply:
If they roll two 1s, they get 13 points.
Otherwise, they get double the value of the lowest numbered die (e.g. if they role a 5 and a 3 they get 6 points)
Player 1 is asked if they want to roll again or stop rolling. If they want to roll again, they repeat the previous step and get more points in the round.
Repeat Step 2 until Player 1 says they want to stop rolling. Here is an example of rolls and points scored for a player for a round: - start with 0 points for the round - player chooses to roll 1 die. rolls a 6, gets 6 points (total for round is 6) - player decides to keep rolling - player chooses to roll 1 die. roll a 3, get 3 points (total for round is 9) - player decides to keep rolling - player chooses to roll 2 dice. roll a 6 and a 5, get 5 points (total for round is 14) - player decides to stop rolling - players total is 14 points, which is 1 away from the goal of 13
Then it is Player 2s turn (repeat steps 1 through 3 for Player 2).
After Player 2 is done rolling, the winner of the round (or a tie) is announced (based upon the rules mentioned above).
The winner of the round gets the number of points that they scored in the round (so if Player 1 wins with 14 points in the round, he gets that many points added to his total points for the game). The loser of the round gets 0 points. If the round was a tie, both players get 0 points.
The game continues until one of the players scores at least 50 total points. After that occurs, the game is over and the winner is announced.
Following are a couple requirements for output that should be produced by the game
a) Display of results of each roll (e.g. rolled a 6 and a 3) and each players running total for the round after each roll (e.g. player 1 now has 18 points for the round).
b) At the end of each round, the current point totals for each player should be output (e.g. Player 1 has 43 points total and Player 2 has 38 points total)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started