Elementary cellular automaton/Random number generator: Difference between revisions

m
Line 375:
=={{header|Phix}}==
Making the minimum possible changes to [[Elementary_cellular_automaton#Phix]], output matches C, D, Go, J, Kotlin, Racket, and zkl,
almostand butwith notthe quitechanges marked [2] C++, Haskell, Perl, Python, Ruby, Scheme, and Sidef, andbut completely different to Rust and Tcl.
No attempt to optimise.
<lang Phix>--string s = ".........#.........", --(original)
string s = "...............................#"&
"................................",
--string s = "#"&repeat('.',100), -- [2]
t=s, r = "........"
integer rule = 30, k, l = length(s), w = 0
Line 389 ⟶ 390:
for i=0 to 80 do
w = w*2 + (s[32]='#')
-- w = w*2 + (s[1]='#') -- [2]
if mod(i+1,8)=0 then res&=w w=0 end if
for j=1 to l do
Line 402 ⟶ 404:
<pre>
{220,197,147,174,117,97,149,171,100,151}
</pre>
{{out}}
with the changes marked [2]
<pre>
{220,197,147,174,117,97,149,171,240,241}
</pre>
 
7,794

edits