image of READY prompt

Wang2200.org

Listing of file='A-MAZING' on disk='vmedia/games-droz01.wvd.zip'

# Sector 543, program filename = 'A-MAZING'
1000 REM *** A-MAZING ***  MAZE GAME
1010 REM << VARIABLES >>
1020 DIM S(209), T(209), D(4)
1030 DIM S$(23,79)1, M$(11,19)1, H$(11,19)1, V$(11,19)1
1040 DIM W$10, K$1, K0$1, K1$1, K2$1, O$1
1050 DIM W$(11,19)1, T$(11,19)1, C$1, D$1, D2$7, D4$13, D6$5, D8$8
1060 D2$ = HEX(080A3A080A8B08)
1070 D4$ = HEX(08082E08082E08082E08088B08)
1080 D6$ = HEX(2E2E2E8B08)
1090 D8$ = HEX(3A080C3A080C8B08)
1100 GOTO 1730
1110 REM << SUBROUTINES >>
1120 DEFFN'210( X0, Y0, Z0 )
1130   IF M$(X0,Y0)=" " THEN 1160
1140   IF O$="^" THEN 1200
1150   IF M$(X0,Y0)=K$ THEN 1200
1160     I = 2*X
1170     J = 4*Y-1
1180     D = D+1
1190     D(D) = Z0
1200 RETURN
1210 DEFFN'200( X, Y )
1220   K$ = M$(X,Y)
1230   K0$ = "^"
1240   D = 0
1250   IF X=11 THEN 1270
1260     GOSUB '210( X+1, Y, 1 )
1270   IF Y=1 THEN 1290
1280     GOSUB '210( X, Y-1, 2 )
1290   IF Y=19 THEN 1310
1300     GOSUB '210( X, Y+1, 3 )
1310   IF X=1 THEN 1330
1320     GOSUB '210( X-1, Y, 4 )
1330   IF D=0 THEN 1580
1340   ON D(RND(1)*D+1) GOTO 1350, 1390, 1430, 1470
1350     V$(X,Y) = "^"
1360     S$(I+1,J-1), S$(I+1,J), S$(I+1,J+1) = " "
1370     X = X+1
1380   GOTO 1500
1390     H$(X,Y-1) = "^"
1400     S$(I,J-2) = " "
1410     Y = Y-1
1420   GOTO 1500
1430     H$(X,Y) = "^"
1440     S$(I,J+2) = " "
1450     Y = Y+1
1460   GOTO 1500
1470     V$(X-1,Y) = "^"
1480     S$(I-1,J-1), S$(I-1,J), S$(I-1,J+1) = " "
1490     X = X-1
1500   IF M$(X,Y)=" " THEN 1520
1510     O$ = "^"
1520   M$(X,Y) = K$
1530   S = S+1
1540   PRINT HEX(010A0A0A0A0A0A0A0A0A0A); TAB(19); S; "CELLS OUT OF 208 HAVE B
     EEN GENERATED"
1550   S(S) = X
1560   T(S) = Y
1570   K0$ = " "
1580 RETURN
1590 DEFFN'220( X, Y )
1600   I = 2*X
1610   J = 4*Y-1
1620   IF X<>1 THEN 1640
1630     S$(I-1,J-1), S$(I-1,J), S$(I-1,J+1) = " "
1640   IF X<>11 THEN 1660
1650     S$(I+1,J-1), S$(I+1,J), S$(I+1,J+1) = " "
1660   IF Y<>1 THEN 1680
1670     S$(I,J-2) = " "
1680   IF Y<>19 THEN 1700
1690     S$(I,J+2) = " "
1700 RETURN
1710 REM << MAIN LINE >>
1720 REM INITIALIZE DISPLAY MATRIX
1730 S$(1,1), S$(1,5) = HEX(23)
1740 S$(1,2), S$(1,3), S$(1,4) = HEX(3D)
1750 S$(2,1), S$(2,5) = HEX(8C)
1760 MAT COPY S$()<2,72> TO S$()<6,72>
1770 MAT COPY S$()<81,72> TO S$()<85,72>
1780 S$(1,78), S$(2,78) = HEX(0D)
1790 S$(1,79), S$(2,79) = HEX(0A)
1800 MAT COPY S$()<1,1659> TO S$()<159,1659>
1810 REM INITIALIZE MODEL STORAGE
1820 INIT(" ") M$(), H$(), V$()
1830 S, T = 0
1840 O$, K1$, K2$ = " "
1850 REM CANCEL VISUAL NOISE
1860 PRINT HEX(03060A0A0A0A0A0A0A0A); TAB(32); "GENERATING MAZE"
1870 REM SELECT STARTING CELL
1880 A1, X1 = INT(RND(1)*11)+1
1890 B1, Y1 = 1
1900 M$(X1,Y1) = "1"
1910 GOSUB '220( X1, Y1 )
1920 S$(I,J) = HEX(8B)
1930 REM SELECT GOAL CELL
1940 A2, X2 = INT(RND(1)*11)+1
1950 B2, Y2 = 19
1960 M$(X2,Y2) = "2"
1970 GOSUB '220( X2, Y2 )
1980 S$(I,J-1) = HEX(84)
1990 S$(I,J) = HEX(81)
2000 S$(I,J+1) = HEX(5F)
2010 REM GENERATE MAZE
2020 IF K1$<>" " THEN 2160
2030 GOSUB '200( X1, Y1 )
2040 IF K0$<>" " THEN 2080
2050 X1 = X
2060 Y1 = Y
2070 GOTO 2170
2080 IF S=208 THEN 2140
2090 T = T+1
2100 PRINT HEX(010A0A0A0A0A0A0A0A0A0A0A0A); TAB(20); T; "CELLS OUT OF"; S; "HA
     VE BEEN EXAMINED"
2110 X1 = S(T)
2120 Y1 = T(T)
2130 GOTO 2030
2140 K1$ = "^"
2150 GOTO 2170
2160 IF K2$<>" " THEN 2350
2170 IF K2$<>" " THEN 2310
2180 GOSUB '200( X2, Y2 )
2190 IF K0$<>" " THEN 2230
2200 X2 = X
2210 Y2 = Y
2220 GOTO 2020
2230 IF S=208 THEN 2290
2240 T = T+1
2250 PRINT HEX(010A0A0A0A0A0A0A0A0A0A0A0A); TAB(20); T; "CELLS OUT OF"; S; "HA
     VE BEEN EXAMINED"
2260 X2 = S(T)
2270 Y2 = T(T)
2280 GOTO 2180
2290 K2$ = "^"
2300 GOTO 2020
2310 IF K1$<>" " THEN 2350
2320 GOTO 2020
2330 REM MAZE IS GENERATED
2340 REM NOW FIND YOUR WAY THROUGH IT
2350 $GIO /F05 (4001 A000, W$) S$()
2360 MAT COPY H$() TO W$()
2370 MAT COPY V$() TO T$()
2380 PRINT TAB(12); "USE NUMBER KEYS -- 2 = DOWN, 4 = LEFT, 6 = RIGHT, 8 = UP"
     ; HEX(0C)
2390 D$ = ":"
2400 P0 = A2
2410 Q0 = B2
2420 P = A1
2430 Q = B1
2440 M0, T0 = 0
2450 $GIO /F05 (4001, W$)
2460 FOR I = 1 TO 2*P-1
2470   $GIO /F05 (400A, W$)
2480 NEXT I
2490 FOR I = 1 TO 4*Q-2
2500   $GIO /F05 (4009, W$)
2510 NEXT I
2520   T0 = T0+1
2530   KEYIN C$, 2550, 2520
2540   GOTO 2520
2550   IF C$="2" THEN 2600
2560   IF C$="4" THEN 2660
2570   IF C$="6" THEN 2730
2580   IF C$="8" THEN 2790
2590 GOTO 2520
2600   IF T$(P,Q)=" " THEN 2520
2610   $GIO /F05 (A000, W$) D$
2620   $GIO /F05 (A000, W$) D2$
2630   D$ = ":"
2640   P = P+1
2650 GOTO 2840
2660   IF Q=1 THEN 2520
2670   IF W$(P,Q-1)=" " THEN 2520
2680   $GIO /F05 (A000, W$) D$
2690   $GIO /F05 (A000, W$) D4$
2700   D$ = "."
2710   Q = Q-1
2720 GOTO 2840
2730   IF W$(P,Q)=" " THEN 2520
2740   $GIO /F05 (A000, W$) D$
2750   $GIO /F05 (A000, W$) D6$
2760   D$ = "."
2770   Q = Q+1
2780 GOTO 2840
2790   IF P=1 THEN 2520
2800   IF T$(P-1,Q)=" " THEN 2520
2810   $GIO /F05 (A000, W$) D8$
2820   D$ = "."
2830   P = P-1
2840 M0 = M0+1
2850 IF P<>P0 THEN 2520
2860 IF Q<>Q0 THEN 2520
2870 PRINT HEX(010C); TAB(12); "PROBLEM SOLVED IN"; M0; "MOVES WITH ELAPSED TI
     ME"; T0; TAB(78); HEX(0C)
2880 FOR X= 1 TO 15000
   : NEXT X
   : GOTO 1000