|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.bio.CellularAutomata
org.generation5.demos.Wolfram1DCA
Implements Wolfram's one-dimensional cellular automata. The class allows for a large neighbourhood size, and supports smooth scrolling of the rendered region.
| Field Summary | |
protected int |
initialState
The initial state of the CA, either RANDOM or MIDPOINT. |
static int |
MIDPOINT
Start the CA with one mid point |
protected int |
neighbourSize
The neighbourhood size. |
static int |
RANDOM
Start the CA with an random line |
protected long |
ruleSpecifier
The rule specifier. |
| Fields inherited from class org.generation5.bio.CellularAutomata |
bufferPosition, bufferSize, caSize, caWorld, caWorld_x, caWorld_y, clrBackground, clrGrid, clrWorld, DOUBLE_BUFFERING, doubleBuffering, drawGrid, ENCLOSED, geometryType, INFINITE, TORODIAL, X_AXIS, Y_AXIS |
| Constructor Summary | |
Wolfram1DCA()
Default constructor. |
|
Wolfram1DCA(int size_x,
int size_y)
Create an instance with world size information. |
|
Wolfram1DCA(int size_x,
int size_y,
int initType)
Create an instance with world size information as well as a starting state. |
|
| Method Summary | |
void |
doStep()
Advance the world by one timestep. |
int |
getInitialState()
Retrieves the inital state type - either random or midpoint. |
long |
getRules()
Return the rule specifier. |
void |
init()
Initializes the 1D CA. |
static void |
main(java.lang.String[] args)
|
void |
render(java.awt.Graphics graphics,
int pw,
int ph)
Renders the 1D cellular automata. |
void |
setInitialState(int initState)
Set the initial world state. |
void |
setRules(int neighbours,
long rule)
Sets the neighbourhood size and the rule specifier. |
| Methods inherited from class org.generation5.bio.CellularAutomata |
clearWorld, drawGrid, flipBuffer, getBackgroundColor, getCASize, getGeometry, getSizeX, getSizeY, getWorldAt, iterateCA, iterateCA, reset, setBackgroundColor, setCASize, setGeometry, setWorldAt, setWorldAtEx, setWorldAtRelative, setWorldColors, setWorldColour, setWorldSize, translateGeometry, writeImage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int neighbourSize
protected long ruleSpecifier
protected int initialState
public static int RANDOM
public static int MIDPOINT
| Constructor Detail |
public Wolfram1DCA()
public Wolfram1DCA(int size_x,
int size_y)
size_x - the x-size of the world.size_y - the y-size of the world.
public Wolfram1DCA(int size_x,
int size_y,
int initType)
size_x - the x-size of the world.size_y - the y-size of the world.initType - the initial state of the world, either RANDOM or MIDPOINT.| Method Detail |
public void doStep()
doStep in interface SteppabledoStep in class CellularAutomatapublic long getRules()
public void setRules(int neighbours,
long rule)
neighbours - the neighbourhood size.rule - the rule specifier.public int getInitialState()
public void setInitialState(int initState)
initState - set to either RANDOM or MIDPOINT.public void init()
init in interface Steppableinit in class CellularAutomata
public void render(java.awt.Graphics graphics,
int pw,
int ph)
render in interface Visualizablerender in class CellularAutomatagraphics - the graphics context.pw - the width of the context.ph - the height of the context.CellularAutomata.render(Graphics, int, int)public static void main(java.lang.String[] args)
args - the command-line arguments to pass to iterateCA.
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||