The Life of Fuzzy


' Fuzzy.bas SmallBASIC 0.12.8 [B+=MGA] 2016-12-18
'Another animation, the life of Fuzzy.

'// Fuzzy Logic Fractal
'// See: Scientific American Magazine, February 1993, "A Partly True Story"
'// http://en.wikipedia.org/wiki/Fuzzy_logic
'// FB - 201108147
'// Adapted to Yabasic 2.769 by Galileo 12/2016

'// drawing area
xa = -1.2 : xb = 1.2 : ya = -1.2 : yb = 1.2
maxIt = 256'// max iterations allowed
'// image size
imgx = 512 : imgy = 512

offs = .8
while 1
for ky = 1 to imgy
for kx = 1 to imgx
x = kx * (xb - xa) / (imgx - 1) + xa
y = ky * (yb - ya) / (imgy - 1) + ya
for i = 1 to maxIt
if sqr(x * x + y * y) + offs > 1.1 then exit
x0 = 1 - abs(x - y)
y = 1 - abs(y - (1 - x))
x = x0
color rgb( (i%8)*32, (i%4)*64, (i%16)*16 )
pset kx + 50, ky + 50
next i
next kx
next ky
offs -= .05
wend