Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GRIDSIZE = 20
- SPEED = 0.01 'Lower # = Faster speed.
- ''''''''''''''''''''''''''''''''''''''''''''''
- BCOLOR 75,75,75
- TCOLOR 255,0,0
- PRINT "Loading..."
- tick=0
- size2=GRIDSIZE
- size=size2*size2
- x=INT((size2+1)/2)
- y=INT((size2+1)/2) 'Start in middle
- d=2 'Direction. '1:Left,2:Up,3:Right,4:Dwn.
- DIM grid(size)
- COLOR 255,255,255
- FOR i=1 TO size
- grid(i)=0 'Off/White: Background grid.
- NEXT
- FOR i=1 TO size2
- FOR j=1 TO size2
- RRECT (i*(ScreenWidth/size2))-(ScreenWidth/size2),(j*(ScreenHeight/size2))-(ScreenHeight/size2),i*(ScreenWidth/size2),j*(ScreenHeight/size2),5
- NEXT
- NEXT
- SLEEP 0.01
- CLS tty
- WHILE x>0 AND y>0 AND x<size2 AND y<size2
- tick=tick+1
- PRINT tick
- IF grid(x*y)=0 THEN 'If off/White.
- grid(x*y)=1 'Turn on/Black.
- COLOR 0,0,0
- d=d-1 'Turn left
- ELSE
- IF grid(x*y)=1 THEN 'If on/black
- grid(x*y)=0 'Turn off/white
- COLOR 255,255,255
- d=d+1 'Turn right
- ENDIF
- ENDIF
- IF d=0 THEN
- d=4
- ENDIF
- IF d=5 THEN
- d=1
- ENDIF
- IF d=1 THEN
- x=x-1
- ENDIF
- IF d=2 THEN
- y=y-1
- ENDIF
- IF d=3 THEN
- x=x+1
- ENDIF
- IF d=4 THEN
- y=y+1
- ENDIF
- SLEEP speed
- CLS tty
- RRECT (x*(ScreenWidth/size2))-(ScreenWidth/size2),(y*(ScreenHeight/size2))-(ScreenHeight/size2),x*(ScreenWidth/size2),y*(ScreenHeight/size2),5
- WEND
- PRINT tick
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement