Game of Life 1.5

org.bitstorm.gameoflife
Class Cell

java.lang.Object
  extended byorg.bitstorm.gameoflife.Cell

public class Cell
extends java.lang.Object

Every cell in the grid is a Cell-object. So it must be as small as possible. Because every cell is pre-generated, no cells have to be generated when the Game Of Life playw. Whether a cell is alive or not, is not part of the Cell-object.

Author:
Edwin Martin

Field Summary
 short col
           
private  int HASHFACTOR
          HASHFACTOR must be larger than the maximum number of columns (that is: the max width of a monitor in pixels).
 byte neighbour
          Number of neighbours of this cell.
 short row
           
 
Constructor Summary
Cell(int col, int row)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Compare cell-objects for use in hashtables
 int hashCode()
          Calculate hash for use in hashtables
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

col

public final short col

row

public final short row

neighbour

public byte neighbour
Number of neighbours of this cell. Determines the next state.


HASHFACTOR

private final int HASHFACTOR
HASHFACTOR must be larger than the maximum number of columns (that is: the max width of a monitor in pixels). It should also be smaller than 65536. (sqrt(MAXINT)).

See Also:
Constant Field Values
Constructor Detail

Cell

public Cell(int col,
            int row)
Constructor

Parameters:
col - column of cell
row - row or cell
Method Detail

equals

public boolean equals(java.lang.Object o)
Compare cell-objects for use in hashtables

See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Calculate hash for use in hashtables

See Also:
Object.hashCode()

toString

public java.lang.String toString()
See Also:
Object.toString()

Game of Life 1.5

This API descibes the Game of Life program, written by Edwin Martin. The source code is available online too.

Copyright 1996-2004 Edwin Martin <edwin@bitstorm.org>.