home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMIGA PD 1
/
AMIGA-PD-1.iso
/
Programme_zum_Heft
/
Programmieren
/
Kurztests
/
ACE
/
Prgs
/
Gfx
/
maze.b
< prev
next >
Wrap
Text File
|
1994-10-03
|
4KB
|
142 lines
'..I snatched this (old) gem from the UseNet group alt.lang.basic (1994).
'..Run from a shell. Assumes font is topaz 8. Open a window and/or screen
'..to improve run-time speed.
DEFINT A-Z
DIM Array1(30, 20), Array2(30, 20)
DIM Maze(24, 80)
RANDOMIZE TIMER
z = 1: c = 2: s = 1
x = INT(RND * 26 + 1)
Array2(x, 1) = 1: r = x
GOTO 2540
2440 IF r <> 26 THEN 2520
IF s <> 11 THEN 2490
r = 1: s = 1: GOTO 2530
2490 r = 1: s = s + 1: GOTO 2530
2520 r = r + 1
2530 IF Array2(r, s) = 0 THEN 2440
2540 IF r - 1 = 0 THEN 2830
IF Array2(r - 1, s) THEN 2830
IF s - 1 = 0 THEN 2680
IF Array2(r, s - 1) THEN 2680
IF r = 26 THEN 2610
IF Array2(r + 1, s) THEN 2610
x = INT(RND * 3 + 1): ON x GOTO 3140, 3210, 3280
2610 IF s <> 11 THEN 2650
IF z = 1 THEN 2670
Q = 1: GOTO 2660
2650 IF Array2(r, s + 1) THEN 2670
2660 x = INT(RND * 3 + 1): ON x GOTO 3140, 3210, 3370
2670 x = INT(RND * 2 + 1): ON x GOTO 3140, 3210
2680 IF r = 26 THEN 2770
IF Array2(r + 1, s) THEN 2770
IF s <> 11 THEN 2740
IF z = 1 THEN 2760
Q = 1: GOTO 2750
2740 IF Array2(r, s + 1) THEN 2760
2750 x = INT(RND * 3 + 1): ON x GOTO 3140, 3280, 3370
2760 x = INT(RND * 2 + 1): ON x GOTO 3140, 3280
2770 IF s <> 11 THEN 2810
IF z = 1 THEN 3140
Q = 1: GOTO 2820
2810 IF Array2(r, s + 1) THEN 3140
2820 x = INT(RND * 2 + 1): ON x GOTO 3140, 3370
2830 IF s - 1 = 0 THEN 3000
IF Array2(r, s - 1) THEN 3000
IF r = 26 THEN 2940
IF Array2(r + 1, s) THEN 2940
IF s <> 11 THEN 2910
IF z = 1 THEN 2930
Q = 1: GOTO 2920
2910 IF Array2(r, s + 1) THEN 2930
2920 x = INT(RND * 3 + 1): ON x GOTO 3210, 3280, 3370
2930 x = INT(RND * 2 + 1): ON x GOTO 3210, 3280
2940 IF s <> 11 THEN 2980
IF z = 1 THEN 3210
Q = 1: GOTO 2990
2980 IF Array2(r, s + 1) THEN 3210
2990 x = INT(RND * 2 + 1): ON x GOTO 3210, 3370
3000 IF r = 26 THEN 3080
IF Array2(r + 1, s) THEN 3080
IF s <> 11 THEN 3060
IF z = 1 THEN 3280
Q = 1: GOTO 3220
3060 IF Array2(r, s + 1) THEN 3280
x = INT(RND * 2 + 1): ON x GOTO 3280, 3370
3080 IF s <> 11 THEN 3120
IF z = 1 THEN 2440
Q = 1: GOTO 3370
3120 IF Array2(r, s + 1) THEN 2440
GOTO 3370
3140 Array2(r - 1, s) = c
c = c + 1: Array1(r - 1, s) = 2
r = r - 1: IF c > 286 THEN 3570
Q = 0: GOTO 2540
3210 Array2(r, s - 1) = c
3220 c = c + 1: Array1(r, s - 1) = 1
s = s - 1: IF c > 286 THEN 3570
Q = 0: GOTO 2540
3280 Array2(r + 1, s) = c
c = c + 1
IF Array1(r, s) = 0 THEN 3330
Array1(r, s) = 3: GOTO 3340
3330 Array1(r, s) = 2
3340 r = r + 1
IF c > 286 THEN 3570
GOTO 2830
3370 IF Q = 1 THEN 3470
Array2(r, s + 1) = c: c = c + 1
IF Array1(r, s) = 0 THEN 3430
Array1(r, s) = 3: GOTO 3440
3430 Array1(r, s) = 1
3440 s = s + 1
IF c > 286 THEN 3570
GOTO 2540
3470 z = 1
IF Array1(r, s) = 0 THEN 3520
Array1(r, s) = 3: Q = 0: GOTO 2440
3520 Array1(r, s) = 1
Q = 0: r = 1: s = 1: GOTO 2530
3570
FOR i = 1 TO 24
FOR j = 1 TO 80
Maze(i, j) = 46
NEXT
NEXT
FOR i = 1 TO 26
FOR j = 1 TO 11
IF Array1(i, j) = 0 OR Array1(i, j) = 1 THEN
Maze(j * 2, i * 3 - 1) = 46
Maze(j * 2, i * 3) = 46
Maze(j * 2, i * 3 + 1) = 127
END IF
IF Array1(i, j) = 2 OR Array1(i, j) = 3 THEN
Maze(j * 2, i * 3 - 1) = 46
Maze(j * 2, i * 3) = 46
Maze(j * 2, i * 3 + 1) = 46
END IF
IF Array1(i, j) = 0 OR Array1(i, j) = 2 THEN
Maze(j * 2 + 1, i * 3 - 2) = 127
Maze(j * 2 + 1, i * 3 - 1) = 127
Maze(j * 2 + 1, i * 3) = 127
END IF
IF Array1(i, j) = 1 OR Array1(i, j) = 3 THEN
Maze(j * 2 + 1, i * 3 - 2) = 127
Maze(j * 2 + 1, i * 3 - 1) = 46
Maze(j * 2 + 1, i * 3) = 46
END IF
NEXT
NEXT
FOR i = 1 TO 79
Maze(1, i) = 127: Maze(23, i) = 127
NEXT
FOR i = 1 TO 23
Maze(i, 1) = 127: Maze(i, 79) = 127
NEXT
COLOR 14, 1: CLS
FOR i = 1 TO 23: FOR j = 1 TO 79
LOCATE i, j: PRINT CHR$(Maze(i, j));
NEXT: NEXT: PRINT: PRINT
END