set display mode 1024,768,32
sync on:sync rate 30
randomize timer()
PosX#=screen height()/2
PosY#=screen width()/2
hide mouse
cls rgb(255,255,255)
R=255:G=255:B=255
 
do
   if R=255 and G=255 and B=255 then flag=1
   if R=0   and G=255 and B=255 then flag=2
   if R=0   and G=0   and B=255 then flag=3
   if R=0   and G=0   and B=0   then flag=4
   if R=255 and G=0   and B=0   then flag=5
   if R=255 and G=255 and B=0   then flag=6
 
   if flag=1 then R=R-1
   if flag=2 then G=G-1
   if flag=3 then B=B-1
   if flag=4 then R=R+1
   if flag=5 then G=G+1
   if flag=6 then B=B+1
   ink rgb(R,G,B),0
 
 
   if timer=0 then X#=rnd(screen width()):timer=rnd(50)+10
   timer=timer-1
 
   if PosX#<X# then PosX#=PosX#+1
   if PosX#>X# then PosX#=PosX#-1
   if PosY#=<Y# then PosY#=PosY#+1
   if PosY#>Y# then PosY#=PosY#-1
 
   if PosX#<20 then X#=screen width()
   if PosX#>screen width()-20 then X#=0
   if PosY#<20 then Y#=screen height()
   if PosY#>screen height()-20 then Y#=0
 
   if PosX#=X# then X#=rnd(screen width())
 
   if R=255 and G=255 and B=255
      X#=rnd(screen width())
      PosX#=rnd(screen width())
      PosY#=rnd(screen height())
   endif
 
   box PosX#-15,PosY#-15,PosX#+15,PosY#+15
   sync
loop