life
Class CleanLife

java.lang.Object
  |
  +--life.CleanLife

public abstract class CleanLife
extends java.lang.Object

Unoptimised implementation of Conway's Life genetic algorithim. Compare with Life.java.


Field Summary
protected  byte[][] age
          Age of this cell.
protected  byte[][] count
          Number of alive neighbours
protected  int dx
          Dimensions of the field
protected  int dy
          Dimensions of the field
 
Constructor Summary
CleanLife(int dx, int dy)
          Create a new Life board with the given width and height
 
Method Summary
protected  void countNeighbours()
           
protected  void evolve()
           
protected abstract  void render()
          Implemented by the sub class to render the board
protected  void touch(int x, int y)
          Touch a cell, increasing it's neighbour count.
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

count

protected final byte[][] count
Number of alive neighbours

age

protected final byte[][] age
Age of this cell. 0 is currently dead.

dx

protected final int dx
Dimensions of the field

dy

protected final int dy
Dimensions of the field
Constructor Detail

CleanLife

public CleanLife(int dx,
                 int dy)
Create a new Life board with the given width and height
Method Detail

render

protected abstract void render()
Implemented by the sub class to render the board

touch

protected final void touch(int x,
                           int y)
Touch a cell, increasing it's neighbour count.

countNeighbours

protected final void countNeighbours()

evolve

protected final void evolve()

update

protected final void update()
Scans the board, updating the neighbours count and computes the next board.