Question: This in C++. Please help me write the definitions for the maze.cpp file for question number 1. The definitions need to be written from the
This in C++. Please help me write the definitions for the maze.cpp file for question number 1. The definitions need to be written from the prototypes in the header file below and with the help of the main() code below.






- Game functions. The game functions are: 0 nextMove( 3 accepts the current location, asks the user for the move: up, down, left and right and returns the room where the user wants to move the mouse. This function does not check whether this move is possible. This check is done in main( 3 or another function. 0 note that previously described checkMaze( ) is also used in the game Assignments 1. . Add the header file maze . hp_p_ described above to your project. Add this file testMaze.cpp to your project as well. Implement the functions prototyped in maze . hpp file and invoked in testMaze .cpp. Place these function definitions in maze.cpp Study Floating and Docking Windows ofMSVS describcdhere. As g i you work on the below project, demonstrate to the instructor the / l usage of this feature. You are to program a maze navigation game. The assignment is broken into two parts. The below game and header file description ' applies to both parts. i Maze navigation. You are to help a mouse to find cheese in a maze. The maze is a square mazeSize*mazeSize grid of rooms. Each room 1as two coordinates. The horizontal coordinate is an integer number ranging from 1 to mazeSize. The vertical coordinate is a letter ranging from 'a' to 'a ' +mazeSizel. The mouse is placed in room a1 (top-left room). The cheese is placed in room a+mazeSizel ,mazeSize (bottom-right room). The maze has walls that separate some pairs of adjacent rooms. Your program should randomly place numWalls in the maze. Two walls must separate a pair ofdiffcrent rooms. That is, if there is a wall rl | 1-2, where rl and r2 are adjacent room coordinates, then there should not be another wall r1 | r2 or r2 | rl. No other checks. such as a check whether the maze is navigable, need to be performed. On user request, the program prints the wall locations. The game proceeds as follows. The program prints the current mouse room and asks the user for the mouse's next move: (u)p, (d)own, (l)eft, (r)ight. or (qjuit. The program should accept a single character. If the move takes the mouse outside the maze or there is a wall between the current mouse room and the next, then the program prints wall and retains the mouse in the same room. Otherwise, it moves the mouse to the new location and the game continues. The check whether the mouse already visited the room is not needed. The game proceeds until the mouse reaches the cheese room or the user quits the game. Maze data structures and function description. The data structures and functions needed to implement the game are declared in this header le. The header file defines two structures: 0 Room stores the number and letter coordinates ofa room: 0 RoomPair stores two adjacent rooms. That is, one room may be up, down, left or right from the other. The maze is represented by an array of RoomPair. This array is first initialized and then used in the game. The functions are separated into three groups: 0 initialization functions that place the walls in the male. The major functions among the initialization functions are pickWall( ) and build( ) Function pickWall( ) selects a random pair ofadjaeent rooms to be separated by a wall. The pseudocode for the function is as follows: select a random location for the first room pick a flag(variable} to indicate if the adjacent room is selected, initialize it to "not selected" while adjacent room is not selected select a random direction (an integer variable indicating direction would work) if direction is up and it is not outside the maze the adjacent room coorindates is set to the same column as first room and row - 1 mark adjacent room as selected else if the direction is left and it is not outside the maze the adjacent room coordinates is set to same row as first room and column 1 mark adjacent room as selected return selected pair of rooms Function build( ) accepts an array of RoomPair by reference and initializes wall locations. It uses the other two initialization functions: pickWall( ) and checkMaze( ) The pseudocode for build( ) is as follows: declare a variable that stores the number of already built walls, initially zero, this variable is to be used as an index in the array of walls loop until all required walls are built invoke pickWallt) to get a new arbitrary placed wall invoke checkMazet) to verify whether this wall is already built if this wall not not built then build the this wall by copying this wall into the array increment the number of built walls Hint 1: T0 randomly assign a character coordinate (from 'a' to mazesize) for the location in pickWall( ), randomly select a number from 1 to mazesize and then use a switch to select the appropriate letter. Altcmatively, you can add an integer to a character as done in ms example. Hint 2: The logic 0fclearWalls( ), checkMaze( ) and build( ) is very similar to the logic of lottery number selection functions in one of the previous labs. - Functions that display maze configuration. After the walls are built, the user is prompted if he would like to see the wall locations (hint: use this option for debugging). The printout functions are: 0 printRoom( ) prints the location ot'a single room 0 printPair( ) prints the location ofa pair of rooms that are separated by the wall, USCSprintRoom(} / / tests maze function implementation #include "maze. hpp" #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
