Displaying the Dijkstra's Matrix
Explore how to display the Dijkstra's distance matrix within a maze by customizing the Grid class in Ruby. Understand how to override methods to render distance values using base-36 encoding, allowing a concise visual representation of distances. This lesson guides you through creating a subclass to visualize these distances, helping you gain insight into maze solving with Dijkstra's algorithm.
We'll cover the following...
We'll cover the following...
Adding the contents_of(cell) method to the Grid class
We'll open up grid.rb and add the new method, contents_of(cell) just before the to_s method.
def contents_of(cell)" "end
The contents_of(cell) method
Now, in the grid.rb class, we'll have to find the to_s method. We’re going to change one line, the bit that describes the body of the cell so that it calls our new contents_of(cell) method. This particular line ...