|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlife.Board
public class Board
Models the board on which Conway's Game of Life is played.
| Field Summary | |
|---|---|
(package private) static int |
BIRTH1
The number of neighbors required for a birth. |
(package private) static int |
BIRTH2
The number of neighbors required for a birth. |
private int |
cellCount
The population of the board. |
static Cell[][] |
cellList
The two-dimensional array that stores all of the cells on the board. |
(package private) static int |
DEATH
The minimum number of neighbors required for a death. |
private int |
generation
The current generation. |
(package private) static int |
MINSURVIVE
The minmum number of neighbors required to survive.. |
private static int |
size
The length of a side of the square board. |
| Constructor Summary | |
|---|---|
Board(int x)
Constructs a square board with side of length x. |
|
| Method Summary | |
|---|---|
int |
getCellCount()
|
int |
getGeneration()
|
static int |
getSize()
|
void |
nextGeneration()
Advances the board to the next generation by applying the rules of the Game of Life. |
static boolean |
testCell(int x,
int y)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int generation
private int cellCount
static final int BIRTH1
static final int BIRTH2
static final int DEATH
static final int MINSURVIVE
public static Cell[][] cellList
private static int size
| Constructor Detail |
|---|
public Board(int x)
x - The length of a side of the square board.| Method Detail |
|---|
public int getGeneration()
public int getCellCount()
public static int getSize()
public static boolean testCell(int x,
int y)
x - The x-coordinate of the cell to be tested.y - The x-coordinate of the cell to be tested.
public void nextGeneration()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||