One-dimensional cellular automata: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(2 intermediate revisions by 2 users not shown)
Line 381:
 
=={{header|Amazing Hopper}}==
<p>Amazing Hopper flavour "BASICO", in spanish.</p>
<p>VERSION 1:</p>
<syntaxhighlight lang="c">
#include <basico.h>
Line 422 ⟶ 423:
Generación #14 000000000000000110000000000000000001100011000000000000000000
Generación #15 000000000000000110000000000000000001100011000000000000000000
</pre>
<p>VERSION 2:</p>
<syntaxhighlight lang="c">
#include <basico.h>
 
algoritmo
x={}
'0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,0' anidar en lista 'x'
'1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0' anidar en lista 'x'
'1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,0' anidar en lista 'x'
 
x2 = x, Nextk=10
decimales '0', token.separador ("")
iterar
imprimir ' #(utf8("Generación #")), #(11-k), "\t", x, NL '
iterar para ( j=2, #(j<60), ++j )
#( x2[j] = ((x[j-1]+x[j]+x[j+1])==2) )
Next siguiente
x = x2
mientras ' k-- '
terminar
 
</syntaxhighlight>
{{out}}
<pre>
Generación #1 001110011010110111001111110111011111010011000001010111111100
Generación #2 001010011101111101001000011101110001100011000000101100000100
Generación #3 000100010111000110000000010111010001100011000000011100000000
Generación #4 000000001101000110000000001101100001100011000000010100000000
Generación #5 000000001110000110000000001111100001100011000000001000000000
Generación #6 000000001010000110000000001000100001100011000000000000000000
Generación #7 000000000100000110000000000000000001100011000000000000000000
Generación #8 000000000000000110000000000000000001100011000000000000000000
Generación #9 000000000000000110000000000000000001100011000000000000000000
Generación #10 000000000000000110000000000000000001100011000000000000000000
Generación #11 000000000000000110000000000000000001100011000000000000000000
 
</pre>
 
Line 5,644 ⟶ 5,682:
__##________________
__##________________
</pre> =={{header|Seed7}}==
A graphical cellular automaton can be found [http://seed7.sourceforge.net/algorith/graphic.htm#cellauto here].
 
> petriCache(i) Then stable = False
If petriCache(i) Then dead = False
Next
 
PetriDish = petriCache
 
If dead Then Return PetriStatus.Dead
If stable Then Return PetriStatus.Stable
Return PetriStatus.Active
 
End Function
 
Private Function BuildDishString(ByVal PetriDish As BitArray) As String
Dim sw As New StringBuilder()
For Each b As Boolean In PetriDish
sw.Append(IIf(b, "#", "_"))
Next
 
Return sw.ToString()
End Function
End Module
 
=={{header|SequenceL}}==
Line 5,983 ⟶ 5,998:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">var trans = "___#_##_"
 
var v = Fn.new { |cell, i| (cell[i] != "_") ? 1 : 0 }
9,476

edits