Question: Simulate a two player snake board game as shown in Figure 1 below. 26 27 29 25 28 30 24 23 21 19 20
Simulate a two player snake board game as shown in Figure 1 below. 26 27 29 25 28 30 24 23 21 19 20 14 15 16 18 13 17 12 b. 87 10 2 3 6. "5 Figure 1: Snake board game You are required to do the following: 1. Create a snake board of size M rows and N columns. As C++ is a row major language, game will start at [M-1][0] and end at [0][N-1] (for odd M) or at [0][0] (for even M). 2. Randomly generate N-1 snakes on the board. In order to generate snake you only need to know head and tail of the snake. Make sure that both head and tail are on the board. Moreover, if head is on row (M:) and tail is on row (M;) then i will always be less than j. 3. Similarly, generate N-1 ladders on the board. 4. In order to start both the player need a six on the dice. Once the game is started display the output on the dice and wait for key press (you can use getch()) before second player's turn. 5. Game will go on until one player wins the game. 6. In case player lands on a snake's head it will come down to its tail, here you need to display a message "oops, snake got you!!!" 7. In case player lands on the bottom of the ladder it will climb the ladder, here you need to display a message "you got lucky" Note: Input validation is mandatory when reading taking input size of the board. Lands on snake's head / lands on bottom of the ladder: The term "lands on" means the final position of each player after each turn. So crossing a snake's head or bottom of ladder does not mean that you have landed.
Step by Step Solution
3.54 Rating (151 Votes )
There are 3 Steps involved in it
To simulate the twoplayer snake and ladder board game follow these steps Step 1 Initialize the Board 1 Input Board Size Prompt the user to input the dimensions M times N of the board Validate the inpu... View full answer
Get step-by-step solutions from verified subject matter experts
