Question: Write a C + + program to play the following game, which the user plays against the computer. This game is played on an imaginary

Write a C++ program to play the following game, which the user plays against the computer.
This game is played on an imaginary game board that has numbered spaces arranged in a circle.
For example, here is what a game board with 12 spaces might look like.
When the program starts, the user is asked to specify how many spaces there are on the g
ame board. There must be at least five spaces.
The computer then randomly selects two spaces (excluding space numbers 0 and 1): One
of the selected spaces is The Goal. The other is The Pit.
The computer announces the two special spaces.
Play then starts from space #0: Each player, in turn, "rolls" a pair of dice and "moves" to
another space by advancing N spaces (where N is the number that came up on the dice). F
or example, using the sample game board with 12 spaces, if the user rolled a 10(6 plus 4)
on her first turn and a 7(3+4) on her second turn, then she would land on space #5. Tha
t's where she would start on her next turn.
The user and the computer take turns rolling the dice and moving around the board. Each
move is displayed on the screen (as text, not graphics; e.g., "You are now on space #3").
The game continues until one player lands on The Goal (and wins the game) or on The Pi
t(and loses the game).
The computer announces the outcome of each game and keeps track of each player's wins
and losses.
The user can choose single play (user must press Examples of the game:
Game 1:
The user selects 12 spaces for the board.
The program randomly sets the Goal at space #8 and the Pit at space #5.
The user rolls a 7, landing on space #7.
The computer rolls a 6, landing on space #6.
On the second turn, the user rolls a 5, returning to space #0.
The computer rolls a 7, moving to space #1.
On the third turn, the user rolls an 8 and lands on the Goal at space #8, winning the game.
Game 2:
The user selects 10 spaces for the board.
The program randomly sets the Goal is at space #7 and the Pit at space #3.
The user rolls a 9, landing on space #9.
The computer rolls a 4, landing on space #4.
On the next turn, the user rolls a 6 and moves to space #5.
The computer rolls a 3 and lands on the Goal at space #7, winning the game.
Game 3:
The user selects 15 spaces for the board.
The program randomly sets the Goal at space #10 and the Pit at space #6.
The user rolls a 5, landing on space #5.
The computer rolls an 8, landing on space #8.
On the next turn, the user rolls a 1 and lands on the Pit at space #6, losing the game.
Write a C + + program to play the following game,

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 Programming Questions!