...

/

Implementing Wilson's Algorithm

Implementing Wilson's Algorithm

Learn to implement Wilson's algorithm in Ruby.

The Wilsons class

The following code uses an array to keep track of all unvisited cells in the grid. Besides letting us query whether a cell has been visited or not, this also lets us quickly choose an unvisited cell from which we can start our loop-erased random walk.

Access this course and 1400+ top-rated courses and projects.