Skip to content

Instantly share code, notes, and snippets.

@moxuse
Created August 31, 2011 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moxuse/1183235 to your computer and use it in GitHub Desktop.
Save moxuse/1183235 to your computer and use it in GitHub Desktop.
Cellular Automaton
(
Task({
var array,rules;
array = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa";
rules = [[//rule "Chell"
"a>a>a" -> "x",
"a>a>x" -> "a",
"a>x>a" -> "x",
"a>x>x" -> "a",
"x>a>a" -> "a",
"x>a>x" -> "a",
"x>x>a" -> "a",
"x>x>x" -> "x",
],[//rule 30
"a>a>a" -> "x",
"a>a>x" -> "x",
"a>x>a" -> "x",
"a>x>x" -> "a",
"x>a>a" -> "a",
"x>a>x" -> "a",
"x>x>a" -> "a",
"x>x>x" -> "x",
],[//rule 90
"a>a>a" -> "x",
"a>a>x" -> "a",
"a>x>a" -> "x",
"a>x>x" -> "a",
"x>a>a" -> "a",
"x>a>x" -> "x",
"x>x>a" -> "a",
"x>x>x" -> "x",
]].choose;
62.do({
array=array.rewriteString(rules).keep(32).postln ;
});
}).play
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment