Write a java program to implement the following:
Two Dimensional Forest Fire CA and Percolation
Lattice sites may have a value of 0, 1 or 2, where 0 represents an empty site (or hole), 1 represents a healthy tree (or tree), and 2 represents a burning tree. During one time step, all of the sites are updated according to the following rule:
- A burning tree (2) becomes an empty site (0).
- A thealthy tree (1) becomes a burning tree (2) if at least one of its nearest neighbours is burning.
- At an empty site (0), a tree grows with probability p.
- A tree without a burning nearest neighbour becomes a burning tree with probability f (e.g. lightening strike).
- Simulate the Cellular Automata model on a square lattice with periodic boundary conditions.
- Initial configuration where each lattice site is a tree with probability q.
- Graphical toolkit Use GUI or abstract windowing toolkit (AWT).