Question: 1 ) Write helper function generateValidMoves ( ) Your first task is to implement the helper function to generate the neighbors for a given location:

1) Write helper function generateValidMoves()
Your first task is to implement the helper function to generate the neighbors for a given location:
Set generateValidMoves(Grid& maze, GridLocation cur)
Given a maze represented as a Grid of booland a current GridLocation cur, this function returns a Set of all valid moves from cur. Valid moves are those GridLocations that are:
Exactly one "step" away from cur in one of the four cardinal directions (N, S, E, W)
Within bounds for the Grid
An open corridor, not a wall
There are a few provided tests for generateValidMoves, but these tests are not fully comprehensive. Write at least 3 additional tests to make sure your helper function works correctly. Remember to label your tests as STUDENT_TEST.

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