Question: Here is the code for stage 1. For Stage 2: please help with the code. Thank you Frogger now has a way to build paths

 Here is the code for stage 1. For Stage 2: please

help with the code. Thank you Frogger now has a way to

build paths to the lillypads using logs and turtles, but we also

want to alter the board and remove tiles sometimes. Command [ [row]

Here is the code for stage 1. For Stage 2:

Overview For the first part of Stage 2, you will need to

implement clearing a row from the game board. You will be given

the clear command and a row, which might look something like this:

Enter command: C 6 This command will delete any turtles or logs

from the given row and set the tiles back to WATER. Similar

to placing tiles, you shouldn't clear lillypads or the river bank, and

you also can't clear a row if Frogger is on that row.

Clarifications - You are not guaranteed the row will be valid or

in bounds. - You can assume you will be given the correct

types as input (ie, char int) - Example 2.1.1: Clear a valid

please help with the code. Thank you

Frogger now has a way to build paths to the lillypads using logs and turtles, but we also want to alter the board and remove tiles sometimes. Command [ [row] Overview For the first part of Stage 2, you will need to implement clearing a row from the game board. You will be given the clear command and a row, which might look something like this: Enter command: C 6 This command will delete any turtles or logs from the given row and set the tiles back to WATER. Similar to placing tiles, you shouldn't clear lillypads or the river bank, and you also can't clear a row if Frogger is on that row. Clarifications - You are not guaranteed the row will be valid or in bounds. - You can assume you will be given the correct types as input (ie, char int) - Example 2.1.1: Clear a valid rows $./cs frogger Welcome to CSE Frogger! How many turtles? 2 Enter pairs: 11 22 Game started 00000 T T X X X X X X X X X Enter command: 13327 00000 T T LLLLLL xxFxx Enter command: c3 00000 T T F Enter command: C 5 00000 T T Enter command: Thank you for playing CSE Froggen! - Example 2.1.2: Out of bounds rows $./csfrogger Welcome to CSE Frogger! How many turtles? 3 Enter pairs: 351411 Game Started 00000 T T T Enter command: c 8 00000 T T T Enter command: c3 00000 T Enter command: Thank you for playing CSE Frogger! Deleting a whole row might be a bit much sometimes, so it's your job to make sure we can also remove just one log. Command r[row][column] Overview In this section you will be given a coordinate pair that may or may not lie on a log. be WATER tiles. You will be given the remove log command, a row and a column, which might look something like this: Same as 2.1, if Frogger is on that log, you can't remove it. If the coordinate pair is out of bounds or the corresponding tile is water already, don't change the board. Clarifications - You can assume you will be given the correct input types (char, int, int). - You can clear the log if there are bugs on it, just not if Frogger is on it. \$./cs_frogger Welcome to CSE Froggen! How many turtles? 0 Game started 00000 F Enter command: 1524 00000 =0 LLL Enter command: r53 00000 =0 = Enter command: Thank you for playing CSE Frogger! - Example 2.2.2: Invalid Coordinate 5. /cs_frogger Welcome to CSE Frogger! How many turtles? Game started 00000 xFxx Enter command: 1316 00000 LL L L L Enter command: r312 00000 LLLLLL xF Enter command: Thank you for playing CSE Frogger! 5. /cs_frogger Welcone to CSE frogger! How nany turtles? Geme started 000=0=0 Enter command: 14414 00000 LLLL xxFxx Enter command: 1426 000=00 LLLLLL xxFxx Enter command: r43 0=0=0=0=0 xxFxx Enter cormand: Thank you for playing CSE Frogger! Example 2.2.4: Clear One Log \$./cs_frogger Welcome to CSE Frogger! How many turtles? O Game started 00000 xxFxx Enter command: 1503 00000 xxFxx Enter command: 1568 00000 LLLLL xxxFxx Enter command: r53 00000 Enter command: Thank you for playing CSE Frogger! Stage 2.3: Moving Frogger The board is finally set up and we can easily change it, so all thats left for this stage is to get Frogger into the game! Commands - Mi up one tile - a : left one tile - s idown one tile - a iright one tile Overview In this part of Stage 2, your program needs to be able to move and display Frogger when given directional commands. We also bring in the win and lose conditions so you know when the game is over, this will be explained later. The directional commands are outlined above and are single letter commands. These move Frogger from one tile to another (so the occupied status of the previous tile is set to filst, and the tile you are going to is set to thue ). If Frogger is at the edge of the board and you attempt to move them off the board, they will not move. This means you should always be able to see Frogger on the board. NOTE: At the moment we aren't testing what happens when Frogger moves into the water, we are only testing movements onto logs, turtles, and the bank. In the next Stage, Frogger will lose a life when they move into water. Frogger now has a way to build paths to the lillypads using logs and turtles, but we also want to alter the board and remove tiles sometimes. Command [ [row] Overview For the first part of Stage 2, you will need to implement clearing a row from the game board. You will be given the clear command and a row, which might look something like this: Enter command: C 6 This command will delete any turtles or logs from the given row and set the tiles back to WATER. Similar to placing tiles, you shouldn't clear lillypads or the river bank, and you also can't clear a row if Frogger is on that row. Clarifications - You are not guaranteed the row will be valid or in bounds. - You can assume you will be given the correct types as input (ie, char int) - Example 2.1.1: Clear a valid rows $./cs frogger Welcome to CSE Frogger! How many turtles? 2 Enter pairs: 11 22 Game started 00000 T T X X X X X X X X X Enter command: 13327 00000 T T LLLLLL xxFxx Enter command: c3 00000 T T F Enter command: C 5 00000 T T Enter command: Thank you for playing CSE Froggen! - Example 2.1.2: Out of bounds rows $./csfrogger Welcome to CSE Frogger! How many turtles? 3 Enter pairs: 351411 Game Started 00000 T T T Enter command: c 8 00000 T T T Enter command: c3 00000 T Enter command: Thank you for playing CSE Frogger! Deleting a whole row might be a bit much sometimes, so it's your job to make sure we can also remove just one log. Command r[row][column] Overview In this section you will be given a coordinate pair that may or may not lie on a log. be WATER tiles. You will be given the remove log command, a row and a column, which might look something like this: Same as 2.1, if Frogger is on that log, you can't remove it. If the coordinate pair is out of bounds or the corresponding tile is water already, don't change the board. Clarifications - You can assume you will be given the correct input types (char, int, int). - You can clear the log if there are bugs on it, just not if Frogger is on it. \$./cs_frogger Welcome to CSE Froggen! How many turtles? 0 Game started 00000 F Enter command: 1524 00000 =0 LLL Enter command: r53 00000 =0 = Enter command: Thank you for playing CSE Frogger! - Example 2.2.2: Invalid Coordinate 5. /cs_frogger Welcome to CSE Frogger! How many turtles? Game started 00000 xFxx Enter command: 1316 00000 LL L L L Enter command: r312 00000 LLLLLL xF Enter command: Thank you for playing CSE Frogger! 5. /cs_frogger Welcone to CSE frogger! How nany turtles? Geme started 000=0=0 Enter command: 14414 00000 LLLL xxFxx Enter command: 1426 000=00 LLLLLL xxFxx Enter command: r43 0=0=0=0=0 xxFxx Enter cormand: Thank you for playing CSE Frogger! Example 2.2.4: Clear One Log \$./cs_frogger Welcome to CSE Frogger! How many turtles? O Game started 00000 xxFxx Enter command: 1503 00000 xxFxx Enter command: 1568 00000 LLLLL xxxFxx Enter command: r53 00000 Enter command: Thank you for playing CSE Frogger! Stage 2.3: Moving Frogger The board is finally set up and we can easily change it, so all thats left for this stage is to get Frogger into the game! Commands - Mi up one tile - a : left one tile - s idown one tile - a iright one tile Overview In this part of Stage 2, your program needs to be able to move and display Frogger when given directional commands. We also bring in the win and lose conditions so you know when the game is over, this will be explained later. The directional commands are outlined above and are single letter commands. These move Frogger from one tile to another (so the occupied status of the previous tile is set to filst, and the tile you are going to is set to thue ). If Frogger is at the edge of the board and you attempt to move them off the board, they will not move. This means you should always be able to see Frogger on the board. NOTE: At the moment we aren't testing what happens when Frogger moves into the water, we are only testing movements onto logs, turtles, and the bank. In the next Stage, Frogger will lose a life when they move into water

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