Question: You must complete the code provided so that it works as follows: Step 1: The code in the initialize() procedure of the Gosu window should

You must complete the code provided so that it works as follows:

Step 1: The code in the initialize() procedure of the Gosu window should be completed to set up cells that are connected to each other with variables joining each cell to its neighbours (using references).

Step 2: The user should be able to left-click on cells on the screen to create mazes (and later in the Maze Search task we will use recursion to find a path through the maze).

Step 3: Each cell clicked on should turn yellow.

Step 4: Once this is working (or perhaps before) add code to print out each cell and indicate whether the reference to the neighbour on each side is nil or not, as per the following:

In this case, there is no neighbour to the north or the west.

Please code this in Ruby and provide the entire code as a final answer. Any inappropriate answers or deviation of any kind from what is requested, will be reported. You must complete the code provided so that it works as follows:

Step 1: The code in the initialize() procedure of the Gosu window

You must complete the code provided so that it works as follows: Step 1: The code in the initialize() procedure of the window should be completed to set up cells that are connected to each other with variables joining each cell to its neighbours (using references). Step 2: The user should be able to left-click on cells on the screen to create mazes (and later in the Maze Search task we will use recursion to find a path through the maze). Step 3: Each cell clicked on should turn yellow. Step 4: Once this is working (or perhaps before) add code to print out each cell and indicate whether the reference to the neighbour on each side is nil or not, as per the following: Cellx:0,y:0north:south:1east:1west: In this case, there is no neighbour to the north or the west. (i) Note: Whether the east or the west neighbour is nil will depend on your perspective, i.e. is your perspective looking into the screen, or out of the screen. Your submitted screenshot should look something like the following: maze_creation.rb

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!