mirror of
https://github.com/gungwald/maze.git
synced 2025-01-03 15:31:40 +00:00
First conversion
This commit is contained in:
parent
cd3254be65
commit
2d8bb977b9
117
maze.baz
Normal file
117
maze.baz
Normal file
@ -0,0 +1,117 @@
|
||||
REM cxxxxxx|\\\\\\\\\\\\\\\\\\\\\\\\\>
|
||||
REM
|
||||
REM MAZE - DRAWS A MAZE-LIKE PATTERN
|
||||
REM AUTHOR - BILL CHATFIELD
|
||||
REM
|
||||
REM cxxxxxx|\\\\\\\\\\\\\\\\\\\\\\\\\>
|
||||
REM
|
||||
REM //////////////
|
||||
REM INITIALIZATION
|
||||
REM //////////////
|
||||
LET SW = 560: LET SH = 192: REM SCREEN WIDTH AND HEIGHT
|
||||
LET W = 10: LET H = 5: REM DEFAULT SEGMENT DIMENSIONS
|
||||
LET KBD = - 16384: REM ADDRESS OF KEYPRESS DETECTION BYTE
|
||||
LET MF = - 16302: REM HGR MIXEDOFF
|
||||
LET RL = 78:RH = 79: REM RNDL AND RNDH
|
||||
LET SEED = PEEK (RL) + PEEK (RH) * 256: REM GET RND SEED
|
||||
LET NA = RND ( - SEED): REM SEED RANDOM NUM GENERATOR
|
||||
DIM COLOURS(5): REM ARRAY FOR 6 COLORS NUM'D 0-5
|
||||
REM USELESS COLORS SKIPPED: BLACK2=4, WHITE1=3
|
||||
LET COLOURS(0) = 1: REM GREEN
|
||||
LET COLOURS(1) = 2: REM VIOLET
|
||||
LET COLOURS(2) = 5: REM ORANGE
|
||||
LET COLOURS(3) = 6: REM BLUE
|
||||
LET COLOURS(4) = 7: REM WHITE2
|
||||
LET COLOURS(5) = 0: REM BLACK1
|
||||
LET PAUSED = 0
|
||||
HOME
|
||||
GOSUB 1000: REM INSTRUCTIONS
|
||||
REM //////////////////////////
|
||||
REM OUTER SCREEN PRINTING LOOP
|
||||
REM //////////////////////////
|
||||
& HGR2 : & MODE(1): REM SWITCH TO FULL SCREEN DOUBLE HIGH RES
|
||||
LET BG = INT ( RND (1) * 2): REM BLACK OR COLORED BG
|
||||
IF BG = 0 THEN FG = COLOURS( INT ( RND (1) * 6))
|
||||
IF BG = 1 THEN BG = COLOURS( INT ( RND (1) * 6)):FG = 0
|
||||
IF FG = BG THEN 300: REM DON'T LET THEM BE THE SAME
|
||||
LET FG = 1:BG = 0
|
||||
PRINT "FG=";FG;" BG=";BG
|
||||
& B COLOR= BG
|
||||
& CLEAR : REM DRAW BG.K
|
||||
& HCOLOR= FG
|
||||
LET X1 = 0:Y1 = 0: REM RESET TO TOP LEFT
|
||||
LET W = INT ( RND (1) * 10) + 20: REM RANDOM SEGMENT WIDTH
|
||||
LET H = INT ( RND (1) * 10) + 8: REM RANDOM SEGMENT HEIGHT
|
||||
REM ///////////////////////////
|
||||
REM INNER SEGMENT PRINTING LOOP
|
||||
REM ///////////////////////////
|
||||
REM 512
|
||||
IF PEEK (KBD) > 127 THEN 600: REM DETECTS A KEYPRESS
|
||||
LET X2 = X1 + W:Y2 = Y1 + H: REM RIGHT END OF SEGMENT
|
||||
REM DETECTS END OF LINE
|
||||
IF X2 > = SW THEN X1 = 0:X2 = X1 + W:Y1 = Y1 + H:Y2 = Y1 + H
|
||||
IF Y2 > = SH THEN 300: REM DETECTS BOTTOM OF SCREEN
|
||||
LET N = INT ( RND (1) * 2): REM SELECT A / OR \ SEGMENT
|
||||
IF N = 0 THEN & HPLOT X1,Y2 TO X2,Y1: REM DRAW A /
|
||||
IF N = 1 THEN & HPLOT X1,Y1 TO X2,Y2: REM DRAW A \
|
||||
LET X1 = X1 + W: REM ADVANCE LEFT END OF SEGMENT
|
||||
GOTO 512: REM LOOP TO NEXT SEGMENT
|
||||
REM ///////////
|
||||
REM KEY HANDLER
|
||||
REM ///////////
|
||||
REM 600
|
||||
GET KEY$
|
||||
IF KEY$ = CHR$ (27) THEN 700: REM ESC QUITS
|
||||
IF KEY$ = "Q" OR KEY$ = "q" THEN 700: REM Q QUITS ALSO
|
||||
IF KEY$ = CHR$ (13) THEN 300: REM RETURN ADVANCES SCREEN
|
||||
REM TAB AND ARROW KEYS ALSO ADVANCE SCREEN
|
||||
IF CHR$ (8) < = KEY$ AND KEY$ < = CHR$ (11) THEN 300
|
||||
IF KEY$ = CHR$ (21) THEN 300
|
||||
IF KEY$ = CHR$ (32) AND PAUSED = 0 THEN PAUSED = 1: GOTO 630
|
||||
IF KEY$ = CHR$ (32) AND PAUSED = 1 THEN PAUSED = 0: GOTO 512
|
||||
GOTO 512: REM UNRECOGNIZED KEY SO JUST CONTINUE
|
||||
REM 630
|
||||
IF PEEK (KBD) < = 127 THEN 630: REM PAUSE
|
||||
GOTO 600: REM CHECK THE KEY THAT UNPAUSED
|
||||
& TEXT
|
||||
PRINT "MAZE TERMINATED";
|
||||
END
|
||||
REM ////////////
|
||||
REM INSTRUCTIONS
|
||||
REM ////////////
|
||||
VTAB 18
|
||||
PRINT "KEYBOARD COMMANDS:"
|
||||
PRINT "-----------------"
|
||||
PRINT "ESC, Q = QUIT"
|
||||
PRINT "TAB, ARROWS, RETURN = NEXT SCREEN"
|
||||
PRINT "SPACEBAR = PAUSE/RESUME"
|
||||
PRINT
|
||||
PRINT "PRESS ANY KEY TO CONTINUE";
|
||||
GET KEY$
|
||||
HOME : VTAB 24
|
||||
RETURN
|
||||
REM ///////////
|
||||
REM FILL SCREEN
|
||||
REM ///////////
|
||||
FOR Y = 0 TO SH - 1
|
||||
HPLOT 0,Y TO SW - 1,Y
|
||||
NEXT
|
||||
RETURN
|
||||
REM c==o
|
||||
REM _/____\_
|
||||
REM _.,--'" ||^ || "`z._
|
||||
REM /_/^ ___\|| || _/o\ "`-._
|
||||
REM _/ ]. L_| || .|| \_/_ . _`--._
|
||||
REM /_~7 _ . " ||. || /] \ ]. (_) . "`--.
|
||||
REM |__7~.(_)_ []|+--+|/____T_____________L|
|
||||
REM |__| _^(_) /^ __\____ _ _|
|
||||
REM |__| (_){_) J ]K{__ L___ _ _]
|
||||
REM |__| . _(_) \v /__________|________
|
||||
REM l__l_ (_). []|+-+-<\^ L . _ - ---L|
|
||||
REM \__\ __. ||^l \Y] /_] (_) . _,--'
|
||||
REM \~_] L_| || .\ .\\/~. _,--'"
|
||||
REM \_\ . __/|| |\ \`-+-<'"
|
||||
REM "`---._|J__L|X o~~|[\\ "Millenium Falcon"
|
||||
REM -Row \____/ \___|[// Modified Corellian
|
||||
REM `--' `--+-' YT-1300 Transport (1)
|
||||
]
|
Loading…
Reference in New Issue
Block a user