Home » Personal collection » Commodore disks » disk32a_commodore_disk_user_3_7.d64 » maze.basic
maze.basic
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Commodore disks » disk32a_commodore_disk_user_3_7.d64 |
Filename: | maze.basic |
Read OK: | ✔ |
File size: | 098F bytes |
Load address: | 0801 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Arnold website » magazines_cdu » magazines_cdu_cdu307_cdu307.d64 » maze.basic
- Personal collection » Commodore disks » disk32a_commodore_disk_user_3_7.d64 » maze.basic
File contents
10 REM BASIC MAZE PROGRAM 100 POKE 53280,0:POKE 53281,11 110 PRINT"<clr><text mode><cursor down><cursor right><white>╲AZE 🭾ROGRAM" 120 PRINT"<cursor right>🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂" 130 PRINT"<cursor down><cursor right>🭰HIS IS A 🭲♠♥╮🭸 EQUIVALENT OF THE" 140 PRINT"<cursor right>MACHINE CODE MAZE GENERATOR. ♠LTHOUGH" 150 PRINT" NOT IDENTICAL, IT USES A VERY SIMILAR" 160 PRINT" ALGORITHM AND METHOD OF STORING DATA." 170 PRINT"<cursor down><cursor right>🭷IMENSIONS:" 180 PRINT"<cursor down><cursor right>╲AXIMUM: 18,10" 190 PRINT"<cursor right>╲INIMUM: 1,1" 200 PRINT"<cursor right>╳ISIBLE 🭸HARACTERS 33-132, 161-255" 210 INPUT"<cursor down><cursor right>🭷IMENSIONS: 18,10<cursor left><cursor left><cursor left><cursor left><cursor left><cursor left><cursor left>";H,V 215 IF H<1 OR V<1 OR H>18 OR V>10 THEN PRINT"<cursor down><cursor right>🭷IMENSIONS OUT OF RANGE !":GOTO 210 220 INPUT"<cursor right>🭸HARACTER: 255<cursor left><cursor left><cursor left><cursor left><cursor left>";C 225 IF C<33 OR C>255 THEN PRINT"<cursor down> 🭰RY A DIFFERENT CHARACTER.<cursor down>":GOTO 220 230 PRINT"<clr><cursor down><cursor down><cursor down><cursor right>🭰HIS WILL TAKE AROUND";INT(H*V/3+1);"SECONDS." 240 TI$="000000" 997 : 998 : 999 REM MAIN LOOP 1000 GOSUB 10000 : REM SETUP VARIABLES 1010 GOSUB 5000 : REM PRINT TIME 1020 IF DC>0 THEN GOSUB 2010 1030 M%(R,S)=M%(R,S) OR 4 1040 DC=T(RND(1)*T) 1050 IF T>0 THEN P=P+1:P%(P)=DC 1060 IF DC=1 THEN S=S-1:M%(R,S)=M%(R,S) OR 1:GOTO 1110 1070 IF DC=2 THEN M%(R,S)=M%(R,S) OR 1:S=S+1:GOTO 1110 1080 IF DC=3 THEN R=R-1:M%(R,S)=M%(R,S) OR 2:GOTO 1110 1090 IF DC=4 THEN M%(R,S)=M%(R,S) OR 2:R=R+1:GOTO 1110 1100 GOSUB 3010:GOTO 1120: REM DEADEND! 1110 M%(R,S)=M%(R,S) OR O 1120 IF P>0 THEN 1010 1130 GOSUB 4010: REM FINISHED, PRINT OUT BOARD. 1140 POKE 198,0: REM CLEAR KEYBOARD 1150 GET K$:IF K$="" THEN 1150 1160 RUN 1999 : 2000 REM CHECK AVAILABLE DIRECTIONS 2010 T(0)=0:T=0 2020 IF S>0 THEN IF M%(R,S-1)=0 THEN T(T)=1:T=T+1 2030 IF S<V THEN IF M%(R,S+1)=0 THEN T(T)=2:T=T+1 2040 IF R>0 THEN IF M%(R-1,S)=0 THEN T(T)=3:T=T+1 2050 IF R<H THEN IF M%(R+1,S)=0 THEN T(T)=4:T=T+1 2060 RETURN 2999 : 3000 REM BACKTRACK THRU MAZE 3010 G=1 3020 Q=P%(P):GOSUB 5000 : REM REPEAT... 3030 IF Q=1 THEN S=S+1 : REM DOWN 3040 IF Q=2 THEN S=S-1 : REM UP 3050 IF Q=3 THEN R=R+1 : REM RIGHT 3060 IF Q=4 THEN R=R-1 :REM LEFT 3070 GOSUB 2010 3080 P=P-1:IF P=0 THEN G=0 3090 IF T>0 THEN G=0 3100 IF G THEN 3020 : REM UNTIL G=0 3110 RETURN 3999 : 4000 REM PRINT MAZE 4010 M%(H,V)=M%(H,V) OR 1 4020 PRINT"<clr>":GOSUB 5000 4030 PRINTC$;" "; 4040 FOR I=1 TO H:PRINTC$;C$;:NEXT:PRINTC$ 4050 FOR J=0 TO V 4060 PRINT C$; 4070 FOR I=0 TO H 4080 IF M%(I,J) AND 2 THEN PRINT" ";:GOTO 4100 4090 PRINT" ";C$; 4100 NEXT I:PRINT 4110 FOR I=0 TO H 4120 IF M%(I,J) AND 1 THEN PRINTC$;" ";:GOTO 4140 4130 PRINTC$;C$; 4140 NEXT I:PRINT C$ 4150 NEXT J 4160 RETURN 5000 PRINT"<home><cursor down><cursor right>🭰IME:<cursor right>";TI$ 5010 RETURN 10000 DIM P%((H+1)*(V+1)),M%(H,V),T%(3) 10010 DC=1:C$=CHR$(C) 10020 RETURN 20000 REM VARIABLES 20010 REM M%(H,V)-MAZE DATA 20020 REM P%(P) -MAZE MOVEMENTS 20030 REM P -POSITION IN P%(-) 20040 REM H,V -HORIZ VERT DIMENSIONS 20050 REM R,S -POSITION IN M%(-,-) 20060 REM I,J -LOOP COUNTERS 20070 REM C$ -CHARACTER 20080 REM DC -DIRECTION CHOSEN 1-4 20090 REM T -NO. OF DIFFERENT 20100 REM DIRECTIONS 20110 REM T(T) -DIFFERENT DIRECTIONS 20120 REM AVAILABLE
� BASIC MAZE PROGRAM 3d � 53280,0:� 53281,11 Ln �"��AZE �ROGRAM"