Requirements [00PA]

Write a program (using a language of your choice) which will explore this percolation model, producing output like the above. That is, your program should carry out the above random cell-opening procedure until the grid percolates, and then display the resulting grid along with the shortest percolating path.

Note that in the given sample output shown above, open cells are displayed as a space, blocked cells as a dot, and open cells through which the shortest percolating path passes as an X. Alternate columns are left blank just to make the grid look relatively square. Your output does not have to look exactly like this.

To receive credit for this problem:

  • Your program runs correctly and can produce output like the above.
  • Your program runs within a few seconds for grids up to 500 \times 500 in size.
  • Your implementation of a generic union-find data structure is in a separate file from the rest of your code (or a separate class within the same file).