MAZE 3D Picture a large cube, filled with cube-shaped rooms, five rooms high, five deep, and five wide. The rooms have doors opening into adjacent rooms, but not all walls have doors, and not all rooms have doors on the same walls. You are lost somewhere inside this cubical maze. There is only one exit. Your goal is to find your way out as fast as possible. Your method is to go through the doors from one room to the next until you find yourself outside the cube. The left-hand side of your screen displays the room you are in, and the doors through which you can move. The top line on the right- hand side shows which way you are facing. The second line displays the keypresses you have available to navigate through the maze. Press "N" to move north, "S" for south, "E" for east, "W" for west, "U" for up, and "D" for down. If you want to change the direction you are facing, press "F" and answer the prompt by pressing N, S, E, or W for the direction you want to face. As a last resort, the coordinates for your present position and/or the coordinates for the exit may be displayed. Press "*" to turn on the position display, and press "?" to turn on the exit display. You can turn these displays off by pressing the same keys a second time. These coordinates are displayed in terms of one to five along the east/west, north/south, and up/down directions. (The "fives" are all the way east, north, and up.) When you run MAZE 3D, it takes a little while to initialize. Think of everything it's doing to set up a challenging maze! Function keys F4 (RUN) and F8 (MENU) retain their function during the game, so you can bail out or start over at any time without having to BREAK. However, if you do break, type GOTO 315, so the function keys will be restored to BASIC. PROGRAM DOCUMENTATION MAZE 3D is based upon the program "Caves of Ice", originally written for the Apple, Atari, and Commodore computers by Robert Tsuk, and published in COMPUTE! magazine. It was about 90 percent rewritten by Tim Ekdom to run on the TRS-80 Model 100. The main program is contained in lines 100. Execution first branches to lines 200 for set-up. Subroutines are line numbers below 100. The wrap-up is in line numbers 300. Comments in the code explain briefly what each section does. The maze is stored in the array MZ() with each array subscript representing one wall. Doors are placed in the walls at random locations by stepping through the maze one cell at a time, generating a random number, and setting the array subscript for the appropriate wall to a value of one if the random number exceeds a fixed value. And the array subscript for the wall of the adjacent cell is also set to one so there is a "doorway" on both sides of the wall. Then a random exit point is generated by setting one of the location coordinates to the outside of the cube (0 or 4, internal values) and generating random values for the other two coordinates. And a random starting position is calculated in the same way. A second array contains orientation values so that the proper room display will be drawn when the direction facing is changed. This occurs in line 110. The program is a little over 5600 bytes long tokenized (.BA) and almost 6900 bytes ASCII (.DO). I have not done all I could have done to compress it in order to maintain legibility for those interested in its operation. You are certainly welcome to try. The comments should be deleted in your saved copy, and there are certainly a few frills that could be cut out if memory is a problem; for instance: the "nasty message" subroutine 50, the "highlight choice" subroutines 71-79, and most of the winner's display following line 300. Variable list: A$ = Keypress input DI = Direction of movement DR$ = Direction facing prompt EE = Exit coordinate EN = Exit coordinate EU = Exit coordinate EW = East/west position EX = Exit display on/off flag FA = Direction facing value FC() = Room orientation I = Wall value to generate pointer into maze array M1 = Minutes calculation M2 = Minutes calculation MI$ = Minutes display MZ() = Maze array N = Counter NS = North/south position P$ = Inverse video on PO = Position display on/off flag Q$ = Inverse video off RA! = Random number S1 = Seconds calculation S2 = Seconds calculation SE$ = Seconds display T1$ = Start time T2$ = Stop time UD = Up/down direction WA = Wall number X1 = Graphics display X2 = Graphics display Y1 = Graphics display Tim Ekdom 72575,1473