|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.sim.automata.CAWolfram1D
public class CAWolfram1D
An extended & customized implementation of 1D Wolfram automata, fully compatible with the classic definition, yet supporting flexible kernel sizes/rule systems and n-ary cell states. The algorithm can be configured to automatically expire cells when they've reached their maximum state/age. This is a varying behaviour to the traditional CA approach, but can produce very interesting results.
Constructor Summary | |
---|---|
CAWolfram1D(int kernelWidth,
boolean isTiling)
|
|
CAWolfram1D(int kernelWidth,
int states,
boolean isTiling)
|
Method Summary | |
---|---|
void |
evolve(EvolvableMatrix m)
|
int |
getNumRuleBits()
|
boolean[] |
getRuleArray()
|
java.math.BigInteger |
getRuleAsBigInt()
|
int |
getStateCount()
|
boolean |
isAutoExpire()
|
boolean |
isTiling()
|
void |
randomize()
|
void |
setAutoExpire(boolean isAutoexpire)
Sets the auto expiration behaviour. |
CAWolfram1D |
setRuleArray(boolean[] r)
Updates the rules using the given array. |
CAWolfram1D |
setRuleID(java.math.BigInteger id)
Uses the BigInteger value to define the new rules. |
CAWolfram1D |
setRuleID(long id)
|
void |
setStateCount(int num)
|
void |
setTiling(boolean state)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CAWolfram1D(int kernelWidth, boolean isTiling)
public CAWolfram1D(int kernelWidth, int states, boolean isTiling)
Method Detail |
---|
public void evolve(EvolvableMatrix m)
evolve
in interface MatrixEvolver
public final int getNumRuleBits()
public final boolean[] getRuleArray()
public final java.math.BigInteger getRuleAsBigInt()
BigInteger
value.public int getStateCount()
getStateCount
in interface CARule
public boolean isAutoExpire()
isAutoExpire
in interface CARule
public boolean isTiling()
isTiling
in interface CARule
public void randomize()
randomize
in interface CARule
public void setAutoExpire(boolean isAutoexpire)
setAutoExpire
in interface CARule
isAutoexpire
- true, if cells expire automatically when their max. state is
reached (i.e. state reverts back to 0)public CAWolfram1D setRuleArray(boolean[] r)
getNumRuleBits()
.
r
- new rules
public CAWolfram1D setRuleID(java.math.BigInteger id)
Uses the BigInteger
value to define the new rules. Only the
lowest N bits of the value are used. The value of N depends on the
current kernel size and can be queried via getNumRuleBits()
. The
top most bit used corresponds with the left most kernel window item.
For example:
id
-
public CAWolfram1D setRuleID(long id)
public void setStateCount(int num)
setStateCount
in interface CARule
public void setTiling(boolean state)
setTiling
in interface CARule
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |