Testing and Tweaking

Learn to create polar grids by using the Recursive Backtracker in Ruby.

The final step

We’re on the final stretch. All that’s left is to test what we’ve got, then tweak one final thing so the finished product looks as good as we can make it.

Our existing polar_grid_test.rb won’t work right now because we’re instantiating the PolarGrid with too many arguments. So, we'll create a new test file to run PolarGrid.

This time around, we should get something much less cobweb-like and much more interesting. We'll create a new file i.e., circle_maze.rb and give it a try. It uses the Recursive Backtracker algorithm, but Aldous-Broder or Wilson’s should also work equally well if we want to experiment with other algorithms.

However, before we run the code, we need to change our PolarGrid class slightly. If we run the file we created in the previous lesson, the output will be something like the figure below.

Get hands-on with 1200+ tech skills courses.