Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Perform a simulation for a simplified and modified version of the Snakes and Ladders game [ 1 ] [ 2 ] with the following characteristics.

Perform a simulation for a simplified and modified version of the Snakes and Ladders game [1][2] with the following characteristics.
Board features (20 points)
The board must contain 30 squares (tiles)
The board must contain 3 snake-type squares indicated with the letter S (snakes)
The board must contain 3 ladder-type squares indicated with the letter L (ladders)
The remaining boxes must be identified as normal boxes with the letter N
Each snake square must move the player back 3 squares (penalty)
Each ladder square must advance 3 additional squares (reward)
Each box is identified with a natural number
Player characteristics (15 points)
The game must support 2 players
Each player identifies himself with a natural number starting from 1
At the beginning of the game all players are in square 1
Player 1 starts the first turn of the game
Game features (20 points)
The game is made up of a succession of turns
In each turn, one of the following 2 possible actions can be executed on the command line:
o Enter the letter C(continue) to continue the game with the
next turn
o Enter the letter E(end) to end the game
o Only before the first shift should the following menu be printed
instructions: Press C to continue next turn, or E to end the game:
o If the key entered is not one of C or E, the
next message: Invalid option, please press C to continue next turn
or E to end the game
Turn execution (30 points)
During each shift, the following information corresponding to the shift must be printed on the console.
The number of the player with the current turn
The box number corresponding to the player's current position
The number obtained by simulating a conventional 6-sided die
The type of space the player should move to after rolling the dice
or N for normal boxes
or S for snake squares
or L for ladder squares
The final square the player must move to
o If the box is Normal, then indicate the final position directly 2
o If the box is Ladder, the final position will be the result of the
corresponding increase in squares indicated by the reward
o If the box is Snake, the final position will be the result of the
corresponding setback in squares, indicated by the penalty
o If a special square (Snake or Ladder) results in
the player in turn lands on another special square, this second
must be ignored, i.e. only one jump or one step back is allowed
per turn
The following example represents the result of the first turn, for player number 1, assuming that he obtains a 5 on the die, and the number 6 square is a snake with a penalty of 3 squares: 115 S 3
Each element of the turn must be separated from the previous one by a blank space
End of the game (15 points)
Once the game is over, either due to a player's victory, due to the instruction of a player or due to the limit of turns, the message: -- GAME OVER -- must be printed on a new line.
If the maximum number of turns has been reached, the following message must be printed: The maximum number of turns has been reached...
If at the end of the turn the current player has reached or passed the final square, the game ends. In this case, the number of the last square on the board must be printed, that is, if the board has 30 squares, it cannot be printed that the square
31. Once the turn information has been printed, the following message must be printed indicating which player won the game instead of the # symbol: Player # is the winner!!!
If the final box has not been passed and the key with the capital letter E is pressed, the game ends and the following message must be printed: Thanks for playing!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

=+8 What are the implications of the EMH for investors?

Answered: 1 week ago

Question

How would you describe Mark Zuckerberg as a team leader?

Answered: 1 week ago