One-dimensional cellular automata: Difference between revisions

Content deleted Content added
Hakank (talk | contribs)
Line 668:
 
function rules(integer tri)
ifreturn tri = 3 or tri = 5 or tri = 6 then
return 1
else
return 0
end if
end function
 
function next_gen(atom gen)
atom new, bit
new += rules(and_bits(gen,3)*2) -- work with the first bit separately
new = 0
 
new += rules(and_bits(gen,3)*2) -- work with the first bit separately
bit = 2
while gen > 0 do