ANTIC VOL. 6, NO. 6 / OCTOBER 1987 / PAGE 24
Itís not easy to be an electron and take care of your business on a challenging circuit board. Enter the world of Resistors and see for yourself. This BASIC program works on any 8-bit Atari computer with a minimum 48K memory, disk or cassette.
Here is your chance to play the role of a charged-up electron on a challenging journey through a vast, complex circuit board. Resistors wonít exactly teach you the fundamentals of electronics. But it does convey an overall sense of how the various elements of a circuit work together—as well as giving you practice in converting binary numbers to decimal. And the game is a lot of fun to play.
During your travels through this scrolling circuit, youíll contact a variety of resistors, diodes and capacitors. As an electron, your job is to match the target number displayed at the bottom of the screen. This is done by charging the correct combination of diodes—each of which contains a different binary number. All charged diode numbers are added together and automatically converted to their decimal equivalent. This sum is displayed at the bottom right of the screen. If you can form the correct target number, your job is complete and itís on to the next round.
To get on the circuit, type in Listing 1, RESISTOR.BAS, check it with TYPO II and SAVE a copy before you RUN it.
If you have trouble typing the special characters in lines 1005 and 19010, donít type them in. Listing 2 will create them for you. Type in Listing 2, check it with TYPO II, and SAVE a copy. When you RUN Listing 2, it creates these hard-to-type lines and stores them in a disk file called LINES.LST.
To merge the two programs, disk users LOAD "D:RESISTOR.BAS" and then ENTER "D:LINES.LST". Remember to SAVE the completed program before you RUN it.
Cassette users: Follow the onscreen prompts after you RUN Listing 2.
Youíll start each round at a random location in the top row. To move around the circuit, simply press your joystick up for north, down for south, left for west, or right for east. You cannot move diagonally.
There are four different types of resistors, each marked with a specific number number of vertical lines—zero, one, two or three. Each type of resistor blocks your electron from moving in one of the four possible directions.
MARKINGS | OPEN | BLOCKED |
0 LINES | N, S, W | E |
1 LINE | S, W, E | N |
2 LINES | N, W, E | S |
3 LINES | N, S, E | W |
To make your journey a little more challenging, the circuit constantly changes. Every time you leave a resistor it randomly converts to a different type. Sometimes this works to your advantage by opening up a blocked pathway. At other times it could block your path. Once inside a resistor, you wonít be able to see its markings. If you canít remember what type youíre in, press your joystick button and the markings will become visible for a few seconds.
For example, to match a target number of 170 (or 10101010 in binary), youíd have to discharge diodes numbered 7, 5, 3 and 1. Figure 1 will help you remember the value of each diode.
DIODE | VALUE | BINARY VALUE | DECIMAL VALUE |
7 | 27 | 10000000 | 128 |
6 | 26 | 01000000 | 64 |
5 | 25 | 00100000 | 32 |
4 | 24 | 00010000 | 16 |
3 | 23 | 00001000 | 8 |
2 | 22 | 00000100 | 4 |
1 | 21 | 00000010 | 2 |
0 | 20 | 00000001 | 1 |
The diodes can be in a charged or uncharged state. They are always uncharged at the start of each round. When you move to an uncharged diode, it becomes charged. The binary number it holds (indicated by its markings) is transmitted to a microprocessor and automatically converted to its decimal equivalent. It is then added to your total and dis played in the lower right corner.
In contrast, if you move to a diode thatís already charged, the number it holds will automatically be subtracted from your total. The diode will then lose its charge. The seven vertical indicator lights beneath the circuit show the present state of each diode. A charged diode is solid and an uncharged one is hollow.
It should now be apparent why the target number can only go up to 255. If you charge all the diodes and add up their decimal equivalents, you get 255. Depending on the combination of diodes charged, you can form any number from 1 to 255.
A capacitor is hollow and contains no markings. Youíll start each game with nine capacitors, decreasing by one with each successive round until you only have one left. Once you enter a capacitor, you have the potential to gain as many as 20 watts. This is because the maximum wattage our electron can hold is 99. After a capacitor is discharged, it turns into a resistor.
To get high scores, you must remember the directions blocked by each type of resistor. Youíll also need a good understanding of binary numbers and how to convert them to decimal. So if you donít already understand binary/decimal conversions when you start playing Resistors, this game will give you some valuable practice.
5-10 | Start-up routines. |
20-90 | Various subroutines. |
105-160 | Reads the joystick for direction of move. |
170-200 | Moves the electron. |
255-285 | Finds resistor value, adds it to total and checks for a win. |
300-330 | Increases wattage for being in a diode. |
500-515 | Wattage is zero, deletes one electron and checks for end of game. |
525-545 | Game over subroutine. |
1000-1025 | Correct answer, increases score and generates new circuit. |
19000-25042 | Redefines character set. |
26000-26035 | Draws main screen. |
26050-26100 | Initializes variables, picks target number and starting position. |
26300-26320 | Setup scrolling routine. |
26399-26440 | Setup circuit board. |
26515-26660 | Randomly plots resistors, diodes and capacitors |
31000-31040 | Title screen. |
Chuck Rosko, 29, is a microbiologist from Pittsburgh, Pennsylvania. He has been programming in Atari BASIC and machine language for five years, specializing in educational games.
Listing 1 RESISTOR.BAS