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 spaces might look like.
When the program starts, the user is asked to specify how many spaces there are on the
ame board. There must be at least five spaces.
The computer then randomly selects two spaces excluding space numbers and : 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 #: 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 spaces, if the user rolled a plus
on her first turn and a on her second turn, then she would land on space # Tha
ts 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; eg "You are now on space #
The game continues until one player lands on The Goal and wins the game or on The Pi
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 :
The user selects spaces for the board.
The program randomly sets the Goal at space # and the Pit at space #
The user rolls a landing on space #
The computer rolls a landing on space #
On the second turn, the user rolls a returning to space #
The computer rolls a moving to space #
On the third turn, the user rolls an and lands on the Goal at space # winning the game.
Game :
The user selects spaces for the board.
The program randomly sets the Goal is at space # and the Pit at space #
The user rolls a landing on space #
The computer rolls a landing on space #
On the next turn, the user rolls a and moves to space #
The computer rolls a and lands on the Goal at space # winning the game.
Game :
The user selects spaces for the board.
The program randomly sets the Goal at space # and the Pit at space #
The user rolls a landing on space #
The computer rolls an landing on space #
On the next turn, the user rolls a and lands on the Pit at space # losing the game.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
