Percolation in three dimensions. Implement a class Percolation3D and a class BooleanMatrix3D (for I/O and random generation)

Question:

Percolation in three dimensions. Implement a class Percolation3D and a class BooleanMatrix3D (for I/O and random generation) to study percolation in three-dimensional cubes, generalizing the two-dimensional case studied in this section.

A percolation system is an n-by-n-by-n cube of sites that are unit cubes, each open with probability p and blocked with probability 1p. Paths can connect an open cube with any open cube that shares a common face (one of six neighbors, except on the boundary). The system percolates if there exists a path connecting any open site on the bottom plane to any open site on the top plane. Use a recursive version of flow() like PROGRAM 2.4.5, but with six recursive calls instead of four. Plot the percolation probability versus site vacancy probability p for as large a value of n as you can. Be sure to develop your solution incrementally, as emphasized throughout this section.

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: