Counting Dead Ends
Learn to show how the frequency of dead ends compares between algorithms.
We'll cover the following...
Introducing the deadends
method
Let’s see how the frequency of dead ends compares between algorithms. We’ll add a method to our Grid
class that collects all of the dead-end cells in the entire grid—those with links to only one other cell—and returns them as a list. Then, we can print the size of that list to tell us how many dead ends there are.
Let's modify grid.rb
by adding the following code.
Access this course and 1400+ top-rated courses and projects.