Elementary cellular automaton: Difference between revisions
Content added Content deleted
(ECA Rule30 on the Medland map. Change phase to get other rules.) |
|||
Line 1,114: | Line 1,114: | ||
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code. |
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code. |
||
=={{header|Furor}}== |
|||
<lang Furor> |
|||
argc 4 < { ."Usage: " 0 argv sprint SPACE 1 argv sprint SPACE ."rule size\n" |
|||
."The \"rule\" and \"size\" are numbers.\n" |
|||
."0<=rule<=255\n" end } |
|||
zero gen |
|||
3 argv #s (#g) sto maxcell |
|||
2 argv (#g) sto rule |
|||
#g argc 5 >= { 4 argv #s (#g) sto gen } |
|||
@maxcell mem !maximize sto livingspace |
|||
@maxcell mem sto originallivingspace |
|||
@maxcell {| @livingspace {} 0 [^] |} @livingspace @maxcell #g 2 / 1 [^] |
|||
infi: {... |
|||
originallivingspace @livingspace #s = |
|||
@livingspace {~ #k @@ { '* }{ '. } print |} NL |
|||
#g |
|||
@livingspace~ lsp: {| |
|||
zero a |
|||
@originallivingspace {} ? @maxcell -- [] { 4 sto a } |
|||
@originallivingspace {} [] { @a 2 | sto a } |
|||
@originallivingspace {+} @maxcell == { 0 }{ {+} } [] { @a 1 | sto a } |
|||
8 {| @rule 1 {} << & { |
|||
{} @a == { @livingspace {}§lsp 1 [^] {<}§lsp } |
|||
} |
|||
|} |
|||
z: @livingspace {} 0 [^] {<} |
|||
|} |
|||
#s @originallivingspace @livingspace == { {.>.} } |
|||
@gen { {...} @gen #g == { {.>.} } } |
|||
...} |
|||
."Generations: " {...}§infi #g printnl |
|||
@livingspace free |
|||
@originallivingspace free |
|||
end |
|||
{ „maxcell” } |
|||
{ „rule” } |
|||
{ „state” } |
|||
{ „livingspace” } |
|||
{ „originallivingspace” } |
|||
{ „a” } |
|||
{ „gen” } |
|||
// ================================================= |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
furor eca.upu 90 100 33 |
|||
..................................................*................................................. |
|||
.................................................*.*................................................ |
|||
................................................*...*............................................... |
|||
...............................................*.*.*.*.............................................. |
|||
..............................................*.......*............................................. |
|||
.............................................*.*.....*.*............................................ |
|||
............................................*...*...*...*........................................... |
|||
...........................................*.*.*.*.*.*.*.*.......................................... |
|||
..........................................*...............*......................................... |
|||
.........................................*.*.............*.*........................................ |
|||
........................................*...*...........*...*....................................... |
|||
.......................................*.*.*.*.........*.*.*.*...................................... |
|||
......................................*.......*.......*.......*..................................... |
|||
.....................................*.*.....*.*.....*.*.....*.*.................................... |
|||
....................................*...*...*...*...*...*...*...*................................... |
|||
...................................*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.................................. |
|||
..................................*...............................*................................. |
|||
.................................*.*.............................*.*................................ |
|||
................................*...*...........................*...*............................... |
|||
...............................*.*.*.*.........................*.*.*.*.............................. |
|||
..............................*.......*.......................*.......*............................. |
|||
.............................*.*.....*.*.....................*.*.....*.*............................ |
|||
............................*...*...*...*...................*...*...*...*........................... |
|||
...........................*.*.*.*.*.*.*.*.................*.*.*.*.*.*.*.*.......................... |
|||
..........................*...............*...............*...............*......................... |
|||
.........................*.*.............*.*.............*.*.............*.*........................ |
|||
........................*...*...........*...*...........*...*...........*...*....................... |
|||
.......................*.*.*.*.........*.*.*.*.........*.*.*.*.........*.*.*.*...................... |
|||
......................*.......*.......*.......*.......*.......*.......*.......*..................... |
|||
.....................*.*.....*.*.....*.*.....*.*.....*.*.....*.*.....*.*.....*.*.................... |
|||
....................*...*...*...*...*...*...*...*...*...*...*...*...*...*...*...*................... |
|||
...................*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.................. |
|||
..................*...............................................................*................. |
|||
.................*.*.............................................................*.*................ |
|||
Generations: 33 |
|||
</pre> |
|||
=={{header|GFA Basic}}== |
=={{header|GFA Basic}}== |