Question: Programming assignment for ENSC 3213 N Player Dice Games using random numbers The program is to be written in C++ The prompts must be clear

Programming assignment for ENSC 3213

N Player Dice Games using random numbers

The program is to be written in C++

The prompts must be clear and allow for correcting typos. i.e. if the input must be "y" or "n" any other input would be ignored and the prompt repeated.

The program will allow the entering of N, the number of players and M, the number of points needed to win.

During each round, the player will roll two dice. The total of the two dice will be added together and displayed as a score. At this point, the played will receive a prompt asking if the player would like to roll the dice again, if the player inputs ythe dice will be rolled again and the sum of those two dice will be added to that players total score. If the player inputs nthe players turn will end, and the next player will begin their turn.

If at any point a player rolls a 1on either dice, that players turn will automatically end, and all points accumulated during that round will be 0.

Game ends when one player has Tot(i) of M or more points and all players have had the same number of turns.

If player i < N gets to the total M numbers of points needed first, the remaining players have one last turn.

At the end of the game, the scores of all players must be clearly shown and the winner indicated.

Player = [ 0 0 ] at start of the game

Tmp = 0 at start of the player's round.

Sample output:

How many players will be playing?

2

How many points would you like to play to?

20

Player 1 turn to roll

Dice one: 4

Dice two: 3

Total: 7

Would you like to roll again? Type y or n

y

Player 1 turn to roll

Dice one: 6

Dice two: 2

Total: 8

Would you like to roll again? Type y or n

n

Player 1 score: 15

Player 2 turn to roll

Dice one: 5

Dice two: 4

Total: 9

Would you like to roll again? Type y or n

y

Player 2 turn to roll

Dice one: 1

Dice two: 3

Total: 4

Player 2 rolled a one

Player 2 score: 0

Player 1 turn to roll

Dice one: 4

Dice two: 6

Total: 10

Player 1 has reached the goal!

Player 1 score: 25

Player 2 turn to roll

Dice one: 5

Dice two: 5

Total: 10

Would you like to roll again? Type y or n

y

Player 2 turn to roll

Dice one: 6

Dice two: 6

Total: 12

Player 2 has reached the goal!

Player 2 score: 22

Player 1 wins!

Player 1 total: 25

Player 2 total: 22

end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!