mirror of
https://github.com/gungwald/maze.git
synced 2024-06-15 19:29:34 +00:00
Created disk
This commit is contained in:
parent
4de38de2cb
commit
130b5f2a32
|
@ -1,2 +1,9 @@
|
||||||
# maze
|
# maze
|
||||||
Draws a maze on the Apple IIe DHGR screen
|
Draws a maze on the Apple IIe DHGR screen
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
Download and run Applewin.
|
||||||
|
Insert maze.dsk into Drive 1.
|
||||||
|
Click the Applewin restart button.
|
||||||
|
|
||||||
|
![Example](maze-example.png)
|
||||||
|
|
BIN
maze-example.png
Normal file
BIN
maze-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
21
maze.baz
21
maze.baz
|
@ -11,6 +11,7 @@ rem
|
||||||
REM //////////////
|
REM //////////////
|
||||||
REM Init
|
REM Init
|
||||||
REM //////////////
|
REM //////////////
|
||||||
|
let d$ = chr$(4)
|
||||||
let ret$ = chr$(13)
|
let ret$ = chr$(13)
|
||||||
let esc$ = chr$(27)
|
let esc$ = chr$(27)
|
||||||
LET SW = 140 : SH = 192: REM SCREEN WIDTH AND HEIGHT
|
LET SW = 140 : SH = 192: REM SCREEN WIDTH AND HEIGHT
|
||||||
|
@ -19,7 +20,7 @@ LET RL = 78 : RH = 79: REM RNDL AND RNDH
|
||||||
LET SEED = PEEK (RL) + PEEK (RH) * 256: REM GET RND SEED
|
LET SEED = PEEK (RL) + PEEK (RH) * 256: REM GET RND SEED
|
||||||
LET NA = RND ( - SEED): REM SEED RANDOM NUM GENERATOR
|
LET NA = RND ( - SEED): REM SEED RANDOM NUM GENERATOR
|
||||||
HOME
|
HOME
|
||||||
VTAB 24
|
print d$;"-dhgr" : rem Load Double Hi-res driver
|
||||||
& HGR2 : REM FULL SCREEN DOUBLE HIGH RES
|
& HGR2 : REM FULL SCREEN DOUBLE HIGH RES
|
||||||
& MODE(2) : REM 16-color mode
|
& MODE(2) : REM 16-color mode
|
||||||
|
|
||||||
|
@ -28,15 +29,14 @@ REM //////////////////////////
|
||||||
REM Draw Screen
|
REM Draw Screen
|
||||||
REM //////////////////////////
|
REM //////////////////////////
|
||||||
£drawScreen
|
£drawScreen
|
||||||
LET BG = 0: rem Black
|
let BG = 0: rem Black
|
||||||
let fg = int(rnd(1) * 15) + 1: rem Gives 1 to 15
|
let fg = int(rnd(1) * 15) + 1: rem Gives 1 to 15
|
||||||
& BCOLOR=BG
|
& BCOLOR=BG
|
||||||
& CLEAR : REM Draw background
|
& CLEAR : REM Draw background
|
||||||
& HCOLOR=FG
|
& HCOLOR=FG
|
||||||
let s = int(rnd(1) * 5) + 4: REM Gives 4 to 8
|
let s = int(rnd(1) * 5) + 4: REM Gives 4 to 8
|
||||||
let s = 8
|
let W = s
|
||||||
LET W = s
|
let H = s
|
||||||
LET H = s
|
|
||||||
PRINT "W=";W;" H=";H;" FG=";FG;" BG=";BG
|
PRINT "W=";W;" H=";H;" FG=";FG;" BG=";BG
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,16 +53,18 @@ for y1 = 0 to my step h
|
||||||
let x2 = x1 + w - 1
|
let x2 = x1 + w - 1
|
||||||
let T = INT(RND(1) * 2): REM Segment type
|
let T = INT(RND(1) * 2): REM Segment type
|
||||||
gosub @drawSegment
|
gosub @drawSegment
|
||||||
next
|
next x1
|
||||||
|
if x1 >= sw then @skipShortSegment
|
||||||
let x2 = sw - 1
|
let x2 = sw - 1
|
||||||
let dy = int((x2 - x1 + 1) * h / w) - 1
|
let dy = int((x2 - x1 + 1) * h / w) - 1
|
||||||
let T = INT(RND(1) * 2): REM Segment type
|
let t = int(rnd(1) * 2): REM Segment type
|
||||||
let yb = y1: rem Backup y1
|
let yb = y1: rem Backup y1
|
||||||
if t = 0 then y1 = y2 - dy
|
if t = 0 then y1 = y2 - dy
|
||||||
if t = 1 then y2 = y1 + dy
|
if t = 1 then y2 = y1 + dy
|
||||||
gosub @drawSegment
|
gosub @drawSegment
|
||||||
let y1 = yb: rem Restore y1
|
let y1 = yb: rem Restore y1
|
||||||
next
|
£skipShortSegment
|
||||||
|
next y1
|
||||||
GOTO @drawScreen
|
GOTO @drawScreen
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +90,7 @@ rem Exit
|
||||||
rem ////////////////
|
rem ////////////////
|
||||||
£exit
|
£exit
|
||||||
& TEXT
|
& TEXT
|
||||||
PRINT "MAZE TERMINATED";
|
print "Maze terminated."
|
||||||
|
print "Run -FP before running Maze again to clear memory";
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user