One-dimensional cellular automata: Difference between revisions
Content added Content deleted
(Added Easylang) |
|||
Line 1,794: | Line 1,794: | ||
9 | ## |
9 | ## |
||
# value: " ## "</syntaxhighlight> |
# value: " ## "</syntaxhighlight> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight lang=easylang> |
|||
map[] = [ 0 0 0 1 0 1 1 0 ] |
|||
cell[] = [ 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 ] |
|||
len celln[] len cell[] |
|||
proc evolve . . |
|||
for i = 2 to len cell[] - 1 |
|||
ind = cell[i - 1] + 2 * cell[i] + 4 * cell[i + 1] + 1 |
|||
celln[i] = map[ind] |
|||
. |
|||
swap celln[] cell[] |
|||
. |
|||
proc show . . |
|||
for v in cell[] |
|||
if v = 1 |
|||
write "#" |
|||
else |
|||
write "." |
|||
. |
|||
. |
|||
print "" |
|||
. |
|||
show |
|||
for i to 9 |
|||
evolve |
|||
show |
|||
. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
.###.##.#.#.#.#..#.. |
|||
.#.#####.#.#.#...... |
|||
..##...##.#.#....... |
|||
..##...###.#........ |
|||
..##...#.##......... |
|||
..##....###......... |
|||
..##....#.#......... |
|||
..##.....#.......... |
|||
..##................ |
|||
..##................ |
|||
</pre> |
|||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |