Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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. image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions