# This program was malfunctioning for a long time because I did not update the code to the New Basic 256 . It is very interesting to see how 2 very simple rules generate two very different patterns . One is a fractal and the other is chaotic

# You can change the rule by activating or deactivating the plotting instruction . See also http://mathworld.wolfram.com/ElementaryCellularAutomaton.html

fastgraphics

graphsize 800,400

For n = 1 to 2

plot (400,1)

For y = 1 to 400

For x = 1 to 800

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 n=1 then gosub chaotic

if n=2 then gosub fractal

next x

refresh

next y

pause 1

clg

refresh

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