Link to code: PercolationVisualizer.java
import javax.swing.JOptionPane;
import princeton.*;
/****************************************************************************
* From Princeton COS 226, Kevin Wayne
* Modified by Owen Astrachan, January 2008
* Modified by Jeff Forbes, October 2008
****************************************************************************/
public class PercolationVisualizer {
public static void main(String[] args) {
// Animate 20 times a second if possible
final int DEFAULT_DELAY = 1000 / 20; // in milliseconds
String input = JOptionPane.showInputDialog("Enter N", "20");
int N = Integer.parseInt(input); // N-by-N lattice
// set x- and y-scale
StdDraw.setXscale(0, N);
StdDraw.setYscale(0, N);
IPercolate perc = new PercolationDFS(N);
//IPercolate perc = new PercolationUF(N, new QuickFind());
// TODO repeatedly declare sites open, draw, & pause until the system percolates
}
}