thestoneage/CellularAutomaton
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Implementation of an Elementary Cellular Automaton written in Scala.
All 256 Elementary Automata are supported and can be created using their Wolfram Code.
Example:
// Create the 184 Automaton with an initial State
val initialState = List(false, true, false)
val automaton = ElementaryCellularAutomaton(184, initialStateAsList)
// Create an infinite collection of the automaton's evolution
val stream = ElementaryCellularAutomaton.evolve(automaton)
// Print the first 4 generations of a the automaton
stream.take(4).foreach(println _)
-+-
--+
+--
-+-
There is also a simple commandline driver named 'demo'. For the
equivalent of the above example, try:
# scala demo 184 010 4
That is:
# scala demo <Wolfram Code> <initial state> <#iterations>