|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--life.Life
Heavily optimised implementation of Conway's Life genetic algorithim. This version includes loop invariant, loop reversal, and local caching optimisations that are normally the responsibility of the compiler.
Field Summary | |
protected byte[][] |
age
Age of this cell. |
protected byte[][] |
count
Number of alive neighbours |
protected int |
dx
Dimensions of the field, minus 1 |
protected int |
dy
Dimensions of the field, minus 1 |
Constructor Summary | |
Life(int dx,
int dy)
Create a new Life board with the given width and height |
Method Summary | |
protected void |
countNeighbours()
Scan the current board and compute the neighbour count. |
protected void |
evolve()
Evolve the cells on the board based on the neighbour count. |
protected abstract void |
render()
Implemented by the sub class to render the board |
protected void |
update()
Scans the board, updating the neighbours count and computes the next board. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final byte[][] count
protected final byte[][] age
protected final int dx
protected final int dy
Constructor Detail |
public Life(int dx, int dy)
Method Detail |
protected abstract void render()
protected final void countNeighbours()
protected final void evolve()
protected final void update()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |