include "window.inc"
Window "GRASS",300,300,1

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

For x =0 to 310
  jx = xmin + x*idx
  For y =0 to 350
    jy = ymin + y*idy
    k =0
    wx=0
    wy=0
  do
    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 do
    End iF
    events
  end do
  Circle(x,y,15,0,Rand(24,255),0)
  Next
if Key 27 then exit for
FlipBuffer
Next
Pause
WinEnd
