Authors
Publication
Pub Details
Date
Pages
BASIC Terms
This month the program ideas and hints are from T/S 2068 Basics and Beyond. I hope you find them useful.
This program is written to display the power of the “POINT” command. It will draw a maze; then check for walls with the POINT command, as you guide the dot through the maze with the arrow keys.
10 PLOT 0,10: LET d=40
15 FOR i=1 to 2: FOR n=1 to 12
20 READ a,b: DRAW a,b: NEXT n
25 PLOT 10,0: LET d=20: RESTORE: NEXT i
30 DATA 20,0,0,50,30,0,0,60,d,0,30,0
35 DATA 0,-30,20,0,0,-40,20,0,0,-20,30,0
40 LET X=5: LET y=5
45 PLOT x, y
50 IF INKEY$="" THEN GO TO 50
55 LET a$=INKEY$
60 LET px=x: LET py=y
65 IF a$="5" THEN LET x=X-1
70 IF a$="6" THEN LET y=y-1
75 IF a$="7" THEN LET y=y+1
80 IF a$="g" THEN LET x=x+1
85 IF POINT (X,Y) THEN GO TO 100
90 PLOT OVER 1;Px,Py
95 GO TO 45
100 BEEP .25,1
105 LET x-px: LET y=py: GO TO 45
Lines 10 to 35 DRAWs a simple maze. Since the two lines are basically the same, the same DATA is used for each, beginning at a different PLOT point. The one segment in the middle must be of a different size for the top and bottom of the path, so a variable is placed in the DATA statement for it.
Lines 40 to 45 puts a dot on the screen for steering through the path. Line 50 Waits for a key press.
Line 60 Saves the dot position in variables px & py for later erasure. Lines 65 to 80 assigns new values to x and y in response to the key press.
Line 85 If the spot indicated by the new x,y coordinate already has an INK pixel, indicating you have bumped into a wall, then go to subroutine.
Line 90-95 erases the dot and loops back to print it in the new position.
Lines 100-105 If you have hit a wall, resets the x and y values to what they were before you pressed the cursor keys and loops back for another try.
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.