LEPRECHAUN'S GOLD by Clyde Bish from ZX Computing Jun/Jul.1983 An amazing game for your 16K Spectrum, courtesy of Clyde Bish of Exeter. This 3D maze game for the Spectrum does not have dinosaurs charging up on you but it does have a Green Goblin. He follows you about, sending an indecisive player back to the start, and giving you a pot of gold if you get to the centre! Interesting Points 1. No maze plan is shown - There are two reasons for this: a) I think it makes the game too easy; and b) the computer does not have a clue about the shape of the maze until play begins! - it all depends on the values of RND in line 210 and the moves a player makes. The maze does, however, once set, remain constant throughout the game (strings x$ and y$ ensure this). 2. The program does not use machine code - I feel that the speed of the Spectrum's PLOT and DRAW commands are fast enough. And, by avoiding machine code, the structure of the program is more easily seen by those who like to dissect programs. 3. The problem of 16K being about 9K! - This has had to result in a compromise: a) The elements of the maze (1000-1710) use, for the most part, numbers and are placed at the beginning of the listing so that they are displayed quickly. b) The parts which can operate slower are put later and use variables and 'VALs' to save bytes. c) The UDGs are set separately and are SAVEd onto tape as bytes to be LOADed in by the main program. Notes on entering the program 1. As explained above the UDGs have to be set first. Type in the program starting at line 1 to line 20 and RUN this. This will set the UDGs above RAMTOP. 2. Now enter the rest of the program and SAVE it, followed by the UDG bytes using command: SAVE "maze" LINE 9000: SAVE "maze" CODE USR "a",168 You will get the usual "start tape then press any key" message. Do so, but don't walk away to make a cup of coffee! After about 45 seconds, the message will appear again. Don't stop the tape, just press any key and the UDG bytes will be saved. To verify use the command: VERIFY "" After (hopefully) the 'OK' message appears stop the tape promptly, then verify the UDGs with: VERIFY "" CODE 3. To LOAD simply enter LOAD "maze". The main program will LOAD, then RUN itself from line 9000 which will LOAD in the UDGs (following on tape) before displaying the instructions, and away you go. Hope you find the GOLD! As a final note, the single or pairs of capital letters shown in the LISTing within quotes are the UDGs and should be entered in the G mode. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Table 1. A breakdown of the program, Leprechaun's Gold, line by line. Lines Description 190-280 Logic controlling the path through the maze (which is set up in line 8000 - see later). The basis is this: a) 210 - If the next-but-one element is a dead-end ('7') then generate a random number. If this is less than 0.2 then the routine skips the dead-end, other wise the dead-end is reached and the player is sent back to the beginning. b) 270 - When the player reaches this decision point again, if they choose to take an alternate pathway (the original choice being held in string y$) then the dead end is avoided. c) 260 - If during a further attempt the player takes a turning different to the first attempt (excepting (b) above) then a dead end is reached and they are sent back to the beginning. 1000-1710 The elements of the maze are displayed on the screen in 3D as if looking down the passage. There are three passage elements (1000: left turn, 1100: right turn and 1200: straight on) and four junction elements (1300: forward or right, 1400: forward or left, 1500: left or right and 1 00 : forward, left or right) plus the dead- end at 1700. These are accessed in passage-junction pairs by line 200. Each element (except those at lines 1200 and 1700) are two part giving first a distant view followed by one with the player (see 4001) in a position to turn. 2000-2020 If the player tries to walk into the passage wall this routine prevents them from doing so. 3000-3060 This section invites a choice to be made (allowing only '5', '7' or '8'). If one is not made in about three seconds then the Green Goblin appears and sends the player back to the start. 4001 This displays the player as a stick man with hands on his hips. 4600 A complex logic routine which, on the command '5' or '8', causes the figure to walk to the left or right and disappear around the corner of the passage. 4800 This causes the figure to move forwards on the command '7'. 5000 This turns the figure to the left or right before walking (or bumping into the wall!). 6000-6015 On LOADing, this is where the program begins. Instructions are given, variables are set, and the difficulty level (the number of elements in the maze ) is chosen. 7000-7999 The winning sequence. The gold is reached (much to the chagrin of the Green Goblin) and the player is invited to play again. It should be noted that the program can be stopped at any junction by pressing '0' in place of '5', '7' or '8' - see 3050. 8000 Here the maze is set up as a string of numbers (representing the elements) held in x$. They are alternately 0-2 and 3-7, there not being two 7s following (or a junction would have two dead-end exits!). 9000 This LOADs the user defined graphics (UDGs). = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -- Another Fine Product transcribed by: Jim Grimwood (jimg@globalnet.co.uk), Weardale, England --