sync on
Do
 
if mouseclick()=1
ox=mousex()
oy=mousey()
while mouseclick()=1
line ox,oy,mousex(),mousey()
ox=mousex()
oy=mousey()
sync
endwhile
endif
 
if mouseclick()=2
fx=mousex()
fy=mousey()
oc=point(fx,fy)
nc=rgb(255,255,255)
dim node(0)
array insert at bottom node(0)
array insert at bottom node(0)
node(1)=fx
node(2)=fy
 
while array count(node(0))<>0
   tot=array count(node(0))
   For x=1 to tot step 2
   dot node(x),node(x+1),nc
   sync
 
   for y=-1 to 1
   for z=-1 to 1
   if point(node(x)+y,node(x+1)+z)=oc
   array insert at bottom node(0)
   array insert at bottom node(0)
   node(array count(node(0))-1)=node(x)+y
   node(array count(node(0)))=node(x+1)+z
   endif
   next z
   next z
 
   next x
 
   for c=1 to tot
   array delete element node(c)
   next c
 
endwhile
 
endif
sync
Loop