Answered step by step
Verified Expert Solution
Question
00
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 with the following characteristics. Board features points The board must contain squares tiles The board must contain snaketype squares indicated with the letter S snakes The board must contain laddertype 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 squares penalty Each ladder square must advance additional squares reward Each box is identified with a natural number Player characteristics points The game must support players Each player identifies himself with a natural number starting from At the beginning of the game all players are in square Player starts the first turn of the game Game features points The game is made up of a succession of turns In each turn, one of the following possible actions can be executed on the command line: o Enter the letter Ccontinue to continue the game with the next turn o Enter the letter Eend 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 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 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 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, ie only one jump or one step back is allowed per turn The following example represents the result of the first turn, for player number assuming that he obtains a on the die, and the number square is a snake with a penalty of squares: S Each element of the turn must be separated from the previous one by a blank space End of the game 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 squares, it cannot be printed that the square 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!!!
Perform a simulation for a simplified and modified version of the Snakes and Ladders game with the following characteristics.
Board features points
The board must contain squares tiles
The board must contain snaketype squares indicated with the letter S snakes
The board must contain laddertype 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 squares penalty
Each ladder square must advance additional squares reward
Each box is identified with a natural number
Player characteristics points
The game must support players
Each player identifies himself with a natural number starting from
At the beginning of the game all players are in square
Player starts the first turn of the game
Game features points
The game is made up of a succession of turns
In each turn, one of the following possible actions can be executed on the command line:
o Enter the letter Ccontinue to continue the game with the
next turn
o Enter the letter Eend 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 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 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
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, ie only one jump or one step back is allowed
per turn
The following example represents the result of the first turn, for player number assuming that he obtains a on the die, and the number square is a snake with a penalty of squares: S
Each element of the turn must be separated from the previous one by a blank space
End of the game 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 squares, it cannot be printed that the square
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
Get Instant Access with AI-Powered 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