org.metasyntactic.games.life
Class FiniteUniverse
java.lang.Object
|
+--org.metasyntactic.games.life.FiniteUniverse
- All Implemented Interfaces:
- Life
- public class FiniteUniverse
- extends java.lang.Object
- implements Life
Method Summary |
int |
getColumns()
|
int |
getRows()
|
boolean |
isLive(int row,
int column)
Returns true if and only if the cell is live in that row and column. |
int |
livingNeighbors(int ROW,
int COLUMN)
Returns the number of cells that are alive in the 8 cells surrounding the cell in
(row,column). |
void |
setLive(int row,
int column,
boolean live)
|
void |
simulate()
|
void |
simulate(int steps)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FiniteUniverse
public FiniteUniverse(int rows,
int columns)
getRows
public final int getRows()
- Specified by:
getRows
in interface Life
getColumns
public final int getColumns()
- Specified by:
getColumns
in interface Life
isLive
public final boolean isLive(int row,
int column)
- Description copied from interface:
Life
- Returns true if and only if the cell is live in that row and column.
- Specified by:
isLive
in interface Life
setLive
public final void setLive(int row,
int column,
boolean live)
- Specified by:
setLive
in interface Life
livingNeighbors
public final int livingNeighbors(int ROW,
int COLUMN)
- Description copied from interface:
Life
- Returns the number of cells that are alive in the 8 cells surrounding the cell in
(row,column). Note: it is implementation specific how boundary conditions will be handled.
- Specified by:
livingNeighbors
in interface Life
simulate
public void simulate()
- Specified by:
simulate
in interface Life
simulate
public void simulate(int steps)
- Specified by:
simulate
in interface Life
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object