andrewb

LOOP.BAS

Oct 24th, 2020
1,195
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 10 REM LOOP
  2. 20 GR:HOME:COLOR=6
  3. 30 STARTX=0:STARTY=0:EX=39:EY=39:SIDE=1
  4. 40 PX=STARTX:PY=STARTY
  5. 50 PLOT PX, PY
  6. 60 IF SIDE=1 THEN GOSUB 200
  7. 70 IF SIDE=2 THEN GOSUB 300
  8. 80 IF SIDE=3 THEN GOSUB 400
  9. 90 IF SIDE=4 THEN GOSUB 500
  10. 100 IF STARTY = EY THEN END
  11. 110 GOTO 50
  12. 200 REM TOP -----
  13. 210 IF PX = EX THEN SIDE = 2
  14. 220 IF PX = EX THEN EX = EX - 1
  15. 230 IF PX < EX THEN PX=PX+1
  16. 240 RETURN
  17. 300 REM RIGHT ---
  18. 310 IF PY = EY THEN SIDE = 3
  19. 320 IF PY = EY THEN EY = EY - 1
  20. 330 IF PY < EY THEN PY = PY + 1
  21. 340 RETURN
  22. 400 REM BOTTOM --
  23. 410 IF PX = STARTX THEN SIDE = 4
  24. 420 IF PX = STARTX THEN STARTX = STARTX + 1
  25. 430 IF PX > STARTX THEN PX = PX - 1
  26. 440 RETURN
  27. 500 REM LEFT ----
  28. 510 IF PY = STARTY THEN SIDE = 1
  29. 520 IF PY = STARTY THEN STARTY = STARTY + 1
  30. 530 IF PY > STARTY THEN PY = PY - 1
  31. 540 RETURN
RAW Paste Data