Percolation

Programming for the web typically involves the connections between systems rather than solving problems traditional to computer science. Because of this, I am mindful to, as Stephen Covey put it, periodically sharpen the saw. This project wasn't difficult, but was the first time I'd used to the HTML5 canvas element to render anything without using D3 or another library.

This problem was taken from Robert Sedgewick's book Algorithms and uses a weight quick-union algorithm to check if there is an open path from the top of the system to the bottom.

Percolation: We model the system as an N-by-N grid of sites. Each site is either blocked or open; open sites are initially empty. A full site is an open site that can be connected to an open site in the top row via a chain of neighboring (left, right, up, down) open sites. If there is a full site in the bottom row, then we say that the system percolates.

For further exploration:

To see more of my projects, visit my portfolio.