include "sdl.inc"

SetDisplay 300,300,1
SetCaption "SDL LAWN"

single kt=50,idx,idy,wx=0,wy=0,jy=0,jx=0,tx=0,ty=0,r=0,y=0,x=0,k=0,c=0
single m =4.0,xmin =2.1,xmax =-0.6,ymin =-1.5,ymax =1.5
idx =(xmax - xmin)/320
idy =(ymax - ymin)/320

ClsColor 0,200,0
For x =0 to 310
jx = xmin + x*idx
For y =0 to 350
  jy = ymin + y*idy
  k =0
  wx=0
  wy=0
  While (1)
    iF r <= m and k < kt 
       tx = wx*wx - wy*wy + jx
       ty = 2*wx * wy + jy
       wx = tx
       wy = ty
       r = wx*wx + wy*wy
       k = k + 1
    Else
       Exit While
    End iF
  Wend
  Ellipse x,y,15,15, 0,Rand(24,255),0
Next
Flip
Next
WaitKey(27)
Ends