s373.cellularautomata
Class CAdata

java.lang.Object
  extended by s373.cellularautomata.CAdata
Direct Known Subclasses:
CA1d, CA2d, CA3d

public class CAdata
extends Object

CAdata base cellular automaton class. holds rules and data mechanics up to 3d.

Author:
Andre Sier, july 2010

Field Summary
 int[] currentGrid
           
 boolean debug
           
 int dimx
           
 int dimy
           
 int dimz
           
 int[] nextGrid
           
 int numactive
           
 int numbit
           
 int numpixels
           
 byte[] rules
           
 int rulesInt
           
 
Constructor Summary
CAdata()
           
 
Method Summary
 void clear()
          clear data.
 byte[] getBinaryRule()
          get rule in the automaton in binary notation.
 String getBinaryRuleString()
          get rule in the automaton in binary string notation.
 int[] getData()
          get data array
 int getRule()
          get rule in the automaton in int notation.
 float random(float max)
           
 void setBinaryRule(byte[] binrules)
          set rule in the automaton in binary notation.
 void setCenter1()
          set center cell 1.
 void setNumBits(int nbits)
          set number of bits in this ruleset.
 void setRule(int rule)
          set rule for automaton in int notation.
 void setRules()
          set random rules for automaton
 void setRules(int rule)
          set rule for automaton in int notation.
 void update()
          update the automaton.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentGrid

public int[] currentGrid

nextGrid

public int[] nextGrid

rules

public byte[] rules

rulesInt

public int rulesInt

dimx

public int dimx

dimy

public int dimy

dimz

public int dimz

numpixels

public int numpixels

numbit

public int numbit

numactive

public int numactive

debug

public boolean debug
Constructor Detail

CAdata

public CAdata()
Method Detail

setRules

public void setRules()
set random rules for automaton


setRule

public void setRule(int rule)
set rule for automaton in int notation.

Parameters:
rule -

setRules

public void setRules(int rule)
set rule for automaton in int notation.

Parameters:
rule -

getRule

public int getRule()
get rule in the automaton in int notation.

Returns:
rule

setBinaryRule

public void setBinaryRule(byte[] binrules)
set rule in the automaton in binary notation. usefull for CA2d & CA3d due to integer overflow at 64bits. CA1d - rules have 8bit precision - send 8 bytes [0/1]. CA2d - rules have 512bit precision - send 512 bytes [0/1]. CA3d - rules have 134217728bit precision - send 134217728 bytes [0/1].

Parameters:
binaryrules -

getBinaryRule

public byte[] getBinaryRule()
get rule in the automaton in binary notation.

Returns:
rule[]

getBinaryRuleString

public String getBinaryRuleString()
get rule in the automaton in binary string notation.

Returns:
String

update

public void update()
update the automaton.


getData

public int[] getData()
get data array

Returns:

setCenter1

public void setCenter1()
set center cell 1.


setNumBits

public void setNumBits(int nbits)
set number of bits in this ruleset.

Parameters:
nbits -

clear

public void clear()
clear data.


random

public float random(float max)


Processing library cellularautomata by Andre Sier. (C) 2010