org.generation5.demos
Class LangtonLoopCA

java.lang.Object
  extended byorg.generation5.bio.CellularAutomata
      extended byorg.generation5.demos.LangtonLoopCA
All Implemented Interfaces:
Steppable, Visualizable

public class LangtonLoopCA
extends CellularAutomata

Implements Langton's self-replicating loop. The code is heavily based upon the Java applet by Eli Bachmutsky, available at: http://necsi.org/postdocs/sayama/sdsr/java/


Field Summary
protected  int[][][][][] rule
          The rules are stored in a 5-dimensional array
 
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
LangtonLoopCA()
          Creates a new instance of LangtonLoopCA
LangtonLoopCA(int size_x, int size_y)
          Creates an instance of LangtonLoopCA with world size information.
 
Method Summary
 void doStep()
          Iterate the loop one timestep.
 void init()
          Initialize the Langton loop.
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.generation5.bio.CellularAutomata
clearWorld, drawGrid, flipBuffer, getBackgroundColor, getCASize, getGeometry, getSizeX, getSizeY, getWorldAt, iterateCA, iterateCA, render, 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

rule

protected int[][][][][] rule
The rules are stored in a 5-dimensional array

Constructor Detail

LangtonLoopCA

public LangtonLoopCA()
Creates a new instance of LangtonLoopCA


LangtonLoopCA

public LangtonLoopCA(int size_x,
                     int size_y)
Creates an instance of LangtonLoopCA with world size information.

Parameters:
size_x - the x-size of the world.
size_y - the y-size of the world.
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

doStep

public void doStep()
Iterate the loop one timestep.

Specified by:
doStep in interface Steppable
Specified by:
doStep in class CellularAutomata

init

public void init()
Initialize the Langton loop.

Specified by:
init in interface Steppable
Specified by:
init in class CellularAutomata

This documentation is part of the Generation5 JDK.