Mine Maze
Stephen Vermeulen
Calgary, Canada
Editor's Note: Stephen suggests that this game can be a source of ideas for a variety of other games. If you come up with an exciting variation, send it in and share it with other COMPUTE! readers. —RTM
This two-player game for 40 column PETs illustrates how the character oriented graphics of the PET, coupled with keyboard input from only three keys, can produce a fast, frustrating, and addictive game. Also, by keeping the graphics as simple and as clear as possible, implementation in BASIC is practical.
Rules Of The Game
A random maze with a clear border around it is drawn on the screen. The two players are then placed within the clear border and play starts. The object, for both players, is to be the survivor of what might appear at first to be a one-sided conflict. The aggressor in the battle is the left-hand player who is represented by the solid ball (shifted Q) graphic character. The ball can only win by running into his opponent, the circle (shifted W).
The circle is usually the defensive player, and is able to drop mines on the playing field. When the ball hits one of these mines it looses one life. To even things up a bit, the ball is given one free life for every ten mines the circle deposits on the playing field and, also, the number of mines that must be dropped before the ball gets its first free life is set randomly.
Lines 100 to 280 print the instructions and get the players' names and the difficulty factor. Default values for these inputs are provided so that eager (or lazy) players can get into play by pressing return 3 times. The next portion (lines 290–380) sets up the playing field and starts the play. The graphic characters used are Q [81] for the ball, W [87] for the circle, [102] for the maze, and * [42] for the mines. The values in brackets are the screen POKE values. The last section (lines 600–680) of the program displays the score and prompts the players for another game.
Heart Of The Program
Now that the sundries have been discussed, the heart of the program can be dissected. The keypress interpreter is the code found in lines 390–410. The branches on "@" and " = " to lines 470 and 480 serve to rotate the player's direction of movement 90 degrees clockwise. The branch on "*" proceeds to lines 490–510 which drop a mine and increment the mine counter and the ball's life counter. After the present key press has been processed the program then moves both players. Before a player can be moved, the program must check for obstacles and hazards by PEEKing the next position and, if necessary, going to one of the two obstruction test routines. The first of these (lines 520–560) is for use when moving the ball. Here the next square is checked to see if it is a maze wall (the ball bounces), or the circle (the ball wins the game), or a mine (the ball looses a life and possibly the game). The second routine (lines 570–590) is the obstacle routine for the circle, here the next square is checked to see if it is a maze wall (making the circle bounce back) or the ball (the ball wins). If the square happened to contain a mine the circle would just erase it (which can be very frustrating if you are controlling the circle).
Official Decrees
And now for some final rules for situations which do arise (these rules were adopted for play in the most recent World Mine Maze 1.9 Championships consisting of a round-robin three player tournament):
- It is decreed that, the Mine Layer shall not lock himself in between the outer boundary and a wall of the maze (see Figure 1).
- It is decreed that, if the Mine Layer has successfully sealed himself off in the inner part of the maze, the Ball must commit suicide by running into as many mines as it takes to die.