# The cellular automation program was malfunctioning for a long time because I did not update the code for the New Basic 256 version .

# This is a new version where the chaotic rule and the fractal rule are used different alternating patterns.

#http://mathworld.wolfram.com/ElementaryCellularAutomaton.html

fastgraphics

graphsize 600,300

For n = 1 to 300

plot (300,1)

Print "Fractal rule every "+n+" rows"

For y = 1 to 300

For x = 1 to 600

a=0

if pixel(x-1,y)=black then a=a+1

if pixel(x,y)=black then a=a+10

if pixel(x+1,y)=black then a=a+100

if y/n = int (y/n) then

gosub fractal

else

gosub chaotic

end if

next x

refresh

next y

refresh

clg

next n

chaotic:

if a=001 or a=110 or a =010 or a=100 then plot (x,y+1)

return

fractal:

if a=001 or a=010 or a=100 then plot (x,y+1)

return

## No comments:

## Post a Comment