` COMPUTE! ISSUE 52 / SEPTEMBER 1984 / PAGE 72`

 Missile Math Garry S. Wick Educational programs are usually designed to reward correct answers. "Missile Math" does this, but also gives extra points for speed. Here's an entertaining way for young students to learn their math. Versions for the Atari, Commodore VIC-20 and 64, the TI-99/4A, Apple, and IBM PC/PCjr. "Missile Math" starts with an animated introduction screen, then a joystick-controlled menu appears on the screen. You have a choice of addition and subtraction or multiplication and division at a slow or fast speed. Using the joystick to select the menu item eliminates possible errors from incorrect typing. The joystick does not give any unacceptable entries when the fire button is pressed to start the game. Different Difficulty Levels After a short pause for the initialization of the player/missile figures, the player sees a screen that displays ENTERING LEVEL 1. As you advance from one level to the next, the math problems become increasingly difficult. The problem appears at the top of the screen. On the bottom there are five possible answers, together with a missile gun which you control with the joystick. The object is to position the gun over the correct answer and launch a missile so that it destroys an enemy spaceship as it traverses the screen. On the upper left corner of the screen are spades representing the number of remaining guns. You begin with three guns. The score is displayed in the upper right corner of the screen. A special kind of problem appears in random locations. For example, you could see 3 + 4 = ? or 3 + ? = 7 or ? + 4 = 7. Addition and subtraction are combined. It is similar for multiplication and division. The correct answer randomly appears in one of five possible locations, so the player never knows in advance where to position the gun. The values of the incorrect answers are chosen so that the correct answer is not obvious. This discourages guessing. A Feisty UFO The UFO moves across the screen at three different heights. The first height is near the top of the screen, and on the two successive flights, the UFO moves closer to the position of the gun. Of course, if the player destroys the UFO on the first pass, it does not appear at the lower altitudes. Instead a new problem appears, and the UFO starts again at the highest position. It is most difficult to destroy the UFO at the highest altitude because there is less time to calculate the correct answer and to fire the missile at the right time to hit the UFO. Destroying the UFO at the middle altitude is easier, and at the lowest altitude, it is easiest. Thus the player gets 25 points for a correct hit on the first pass, 10 points for the second pass, and 5 points for the third pass. When the gun is positioned over the correct answer and scores a hit, the UFO explodes with sound effects, disappears, and the number of points earned appears in its place. Then a new problem appears on the screen. If you score a direct hit on the UFO, but have the gun over an incorrect answer, the UFO briefly changes colors, makes a funny sound and continues on its way. You must then try again on the next pass of the UFO. Three consecutive misses or incorrect answers and the UFO destroys the gun and one of the spades disappears. Sound effects accompany the disappearance of the spade and the correct answer blinks on and off as an encouraging message flies onto the screen. The game ends when all three guns have been destroyed. To advance to the next level, you must score 50 points. If the present level is too easy, you can enter the next level by solving as few as two problems, receiving 25 points for each correct answer. If you only succeed in destroying the UFO on its third pass each time, then you will have to solve ten problems before moving to the next level. Thus you get more practice on problems that stretch your abilities. You can quickly pass by the problems that you find easy. Bonus Points You can earn the 50 points necessary to advance to higher levels with any combination of 5, 10, or 25 points, but you can earn bonus points for speed and accuracy. If the average score for the problems solved in a level is 25, the player receives 50 bonus points. The only way to get 50 bonus points is to score correct hits on the first two problems in a level during the first pass of the UFO. If you average ten points or better per problem (but less than 25), you will earn 25 bonus points. There are no bonus points if you average less than ten points per problem. Bonus points are displayed with suitable fanfare. There are a few features of Program 1 that require special mention. The joystick-controlled menu appears in Program 1 at lines 5000 through 5230. It uses screen memory locations to identify the choices available so that it is impossible to make an incorrect entry and cause an error. Player/Missile Machine Language The UFO is Atari Player 1 and the explosion character is Player 3. In order to rapidly exchange them when a correct hit has occurred, it is necessary that the two players always be at the same vertical position. (Then it is easy to POKE the UFO horizontally off the screen and to POKE the explosion at the former position of the UFO.) BASIC was too slow to move both players vertically. A machine language program to move two players vertically lower on the screen is in lines 4000–4060. The parameters for the current location and length of the players are set by the subroutine at line 3500. It is a little tricky and not at all obvious how to determine when the gun is over the correct answer. The playfield characters (the answers) and the players use different coordinate systems. It is necessary to establish an equation that maps one coordinate system to the other. The appropriate equations are: ```X(P / M) = 4 * X (Playfield) + 45 Y(P / M) = 4 * Y (Playfield) + 17 ``` where X and Y are the horizontal and vertical coordinates respectively. The X equation is used in line 2510 to determine whether the gun is over the correct answer, and the Y equation is used in line 3025 to position the number of points earned at the same height as the explosion of the UFO. Programmer's Notes: VIC Version The VIC-20 version of "Missile Math" requires at least an 8K expander. To make it easier to enter this version, the machine language portion of the program has been listed in MLX format. To enter Missile Math, you must enter Program 2 using the VIC MLX Program elsewhere in this issue. The starting address is 12288 and the ending address is 13295. After you have entered and saved Program 2, enter Program 3 as you would a normal BASIC program and save it to tape or disk. To run Missile Math, you must first enter these POKEs. ```POKE 43, 1 : POKE 44, 24 : POKE 641, 0 : POKE 642, 24 : POKE 6144, 0 ``` Type NEW and load Program 2, bypassing the normal relocator by adding, 1 to the LOAD command. Here's how your LOAD command should look: From tape: ```LOAD "filename" ,1, 1 ``` From disk: ```LOAD "filename" ,8, 1 ``` Now type NEW, then load and run Program 3. Notes On The Commodore 64, TI, Apple, And IBM PC/PCjr Versions Instructions for all these versions are included within the programs themselves. The 64 version (Program 4) requires a joystick in port 2. The TI-99/4A version (Program 5) requires Extended BASIC and may be played with either a joystick or the keyboard. The Apple version (Program 6) requires a paddle controller. The IBM PC/PCjr version (Program 7) is controlled from the keyboard.