Switchbox (Todd Heimarck)

Switchbox for the C64 - Banner Image

Title – Switchbox
System –
Commodore 64
Author –
Todd Heimarck
Publication
– COMPUTE!, Issue 70, March 1986
Page Scans1 2 3 4 5 6 7
Preserved by – eboy71
Recommended EmulatorVICE

Switchbox, by Todd Heimarck, from COMPUTE!, Issue 70, March 1986 - Screen Shot

Switchbox – Download ROM

Loading the Game –

  • Mount the disk image (Compute 070 Switchbox.d64) in your emulator. In VICE, this is done by selecting File → Attach Disk Image
  • Load the app by typing LOAD”SWITCHBOX”,8
  • Once loaded, type RUN to play

Article Text & Instructions

Here’s a challenging game of strategy that looks easy at first, but takes time to master and permits many variations. The original program is written for the Commodore 128. We’ve added new versions for the Commodore 64, Apple 11, eight-bit Atari computers, IBM PC/PCjr and Atari 520ST, as well as an Amiga version with speech and stereophonic sound effects.

Playing “Switchbox” is like putting dominos in place for a chain reaction— either you’re setting them in position or you’re knocking them over. Winning requires skill and a sense of when to go for points and when to lay back and wait for a better board. The goal is simple: You try to score more points than your opponent by dropping balls into a box full of two-way switches. Each switch has a trigger and a platform. If the ball lands on an empty platform, it stops dead. But if it hits a trigger, it reverses the switch and continues. In many cases dropping a single ball creates a cascading effect — one ball sets another in motion, which sets others in motion, etc., all the way down.

Type in the program listing for your computer, and save a copy before you run it. If you’re using a Commodore 128, enter the 128 version in 128 mode (not 64 mode). The Atari version runs on any eight-bit Atari computer with at least 16K of memory. The Apple II game works on any Apple II machine, under either ProDOS or DOS 3.3. The IBM PC/PCjr version requires BASICA (PC) or cartridge BASIC (PCjr), and a color/graphics adapter on the PC.

The Amiga version of Switchbox requires 512K of memory and Amiga BASIC by Microsoft (not ABasiC, the version supplied with a few very early Amigas). If you have only ABasiC, contact your dealer about getting an upgrade to Amiga BASIC. Before running the program, make sure that the Amiga’s display is set for 80 columns of text (if it isn’t, the numbers printed on the screen won’t match the rest of the display). If you’ve previously changed the display to 60 columns, open the Preferences icon and change it back to 80, then close Preferences, activate BASIC and run the program as usual.

Since the Amiga program doesn’t use line numbers, we’ve placed small arrows in the listing to show you where each line ends. Don’t try to type in the arrows: There’s no such character in the Amiga’s character set. Wherever you see an arrow in the listing, press Return (or move the cursor off that program line) to enter the line. It’s important to include the colon (:) that appears after program labels (Nextround:, Setup:, and so on). If you accidentally omit the colon, you’ll make it impossible for the computer to use that label correctly.

Before typing in the 520 ST version you must turn off the buffered graphics by clicking on Buf Graphics in the Run menu. You can be in either medium or low resolution mode when typing in the program; but before running it, you must be in low resolution mode. This can be done by selecting Set Preferences from the Options menu on the desktop and clicking on Low.

A Box Of Switches
Switchbox is a tale of twos; Each switch has two parts, two positions, two states, two paths in, and two paths out. The two parts are the platform and the trigger. A switch can lean to the left (platform left, trigger right) or to the right (platform right, trigger left).

The trigger is weak, and always allows balls to pass. But the platform is strong enough to hold a single ball. So the platform either holds a ball — it’s full — or it does not and is empty. When a ball sits on a platform, the switch is said to be loaded, or full.

Figure 2 shows a full switch over two empty switches. The platform holds a ball and leans to the left. The trigger extends to the right. Note that the switch on top has two pathways leading in, the left path and the right, and that the right path leading out is the left path into one of the switches below. The left path of the top switch leads into the right path of the other, the switch below and to the left. If you drop a ball down the righthand path, it hits the trigger and flips that switch to the right. Then it continues down, hits the lefthand trigger below and flips that switch as well. In the meantime, the ball on the platform is set in motion (when the switch is flipped) and then hits the trigger. The top switch is reset to point to the left. The second ball then drops a level to the platform below, where it stops. The playing field is composed of five levels, with four switches in the first level and eight in the bottom level. At the beginning of the game, there are no balls on the field — all platforms are empty — and the position of each switch is chosen randomly.

Moving Down The Path
Players alternate dropping balls into one of eight entry points. These balls (and others) may or may not make it all the way through the switchbox, to one of the 16 exit paths. Balls fall straight down (with one exception), so a ball’s movement is always predictable. When it hits an empty switch, one of two things can happen. If it lands on the empty platform, it stops dead in its tracks. But if it lands on a trigger, it falls through to the next level below.

Moving balls always make it through loaded switches. Triggers allow balls to continue, and move the switch to the other position. If it’s loaded, the dead ball on the platform is put into motion and it hits the trigger that just moved over. This makes the switch go back to its original position, but with an empty platform. So when a ball hits the trigger of a loaded switch, its motion continues unabated. The switch moves, the ball on the platform begins to fall and it hits the newly placed trigger. The newly emptied switch moves back again, and the two balls drop to the next level.

There’s one more possibility: a ball dropping onto a platform that already holds a ball. A platform can’t hold any more than one ball, so when this happens one of the balls slides over to the trigger. So the ball does not move straight down — it slides over to the next pathway. This is the exception to the rule that balls drop in a straight line. Of course, when the ball hits the trigger, the switch changes position, causing the other ball to drop and hit the trigger.

The Chain Reaction
At the game’s start, all platforms are empty, so four of eight entry paths are blocked. Remember that your turn ends when a ball hits an empty platform and stops. As the switches fill up, the chances increase that a ball will descend through several levels. The goal is to score points by getting balls to pass all the way through the maze of the switchbox. The best way to collect a lot of points is to cause a chain reaction.

A ball that hits a loaded switch from either side continues on its way. And the previously inert ball on the platform starts moving. One enters, two exit. If both of those balls encounter full platforms, four drop from the switches. The pathways are staggered, so the effects can spread outward, with more and more balls cascading toward the bottom.

Rather than taking an easy point or two, it’s often worthwhile to build up layers of loaded switches. Watch out for leaving yourself vulnerable, though. Because players take turns, you’ll want to leave positions where your opponent’s move gives you a chance to create a chain reaction. The best strategy is to play defensively. Look ahead a move or two, and watch for an opening that allows you to score several points at once.

Four Quarters
A game of Switchbox always lasts four rounds. In the first (equality), each exit counts for two points. Your goal is to score ten points. The second quarter has more points available, as well as a higher goal. If you look at the exits, you’ll see that the further away from the middle, the higher the point value. The numbers increase in a “Fibonacci” sequence: 1, 2, 3, 5, 8, and so on. Each number is the sum of the previous two (1 -1-2 is 3, 2-1-3 is 5, 3-1-5 is 8, etc.). The target score in round two is 40.

In round three the numbers are a bit lower. They increase arithmetically (1, 2, 3, 4, up to 8 in the corners). A goal of 20 points brings you to round four, where you can score big. Here the numbers are squares: 1, 4, 9, 16, 25, all the way to 64 at the edges. In rounds two through four, it’s sometimes prudent to leave a middle path open for your opponent to score a few points, in order to gather a high score on the big numbers to the left and right.

Each round lasts until one player has reached the goal. At that point the other player has one last turn before the round ends. It’s possible to win the round on this last-chance play; watch out for barely topping the goal and leaving a chain reaction open for the other player. An arrow points to the scoreboard of the player whose turn it is. On the other side of the screen, you’ll see a number where the arrow should be. That’s the goal for the current round (the Amiga version displays the goal on both sides of the screen, below the scoreboards).

Bonus points are awarded at the conclusion of each round. Four numbers appear below the scorecards. The first is simply the total so far. The second is the total plus a bonus of the goal for the round if the player’s points are equal to or greater than the goal. For example if the goal is 20 and you get 18, there’s no bonus. If you score 22, the bonus is the goal for that round (20) and you’d have 42 points. The third number under the scoreboard is the difference between scores for the rounds. If you win by two points, two is added to your score (and two is subtracted from the other player). The final number is the grand total of the first three scores and bonuses. Rounds one and three are fairly low-scoring with low goals. You may want to seed the field with extra balls during these quarters, so you can collect more points in the second and fourth quarters.

Variations
Although the goal of the game is to score the most points, there’s no reason you couldn’t agree to play for low score. In a “lowball” game, you would try to avoid scoring points. You wouldn’t necessarily play backwards, you would have to adjust the strategy of where to place the balls. Fill up the board as much as possible and leave your opponent in a situation where he or she is forced to score points.

The DATA statements at the beginning of the program (the Setup: routine in the Amiga version) determine the goal for each round and the point values for the exit paths. You can prolong the game by doubling the goals; this also dilutes the value of a big score at the beginning of a round, preventing one player from winning on the first or second turn. An interesting variation is to assign negative values to some slots. If some paths score negative points, you are forced to think harder about where the balls will drop.

In addition to the numbered keys (1-8), the plus (+) and minus (— ) keys are active. Pressing plus drops a ball at random down one of the eight entry paths. Pressing minus allows you to pass your turn to your opponent.

Once you’ve mastered the regular game, you can add some new rules. Each player gets three passes per half, similar to the three timeouts in a football game. If you don’t like the looks of the board, press the minus key to use one of your passes. After one player has skipped a turn, the other player must play (this prevents the possibility of six passes in a row). It’s also a good idea to make a rule that a player can’t pass on two consecutive turns. You can also give each player two random moves to be played for the opponent. In other words, after making a move, you could inform your opponent that you’re going to give him one of your random moves and you would press the plus key.

Here’s one more change you could make: Instead of alternating turns, allow a player to continue after scoring. When a player drops a ball and scores some points, the other player would have to pass (by pressing the minus key). If the first player scores again, the opponent passes again, and so on until no more points are scored.

Playing Solitaire
To drop a ball, press a numbered key (1-8). If you’re using a 128, ST or Amiga, the numeric keypad is convenient for choosing a move. By using the pass and random turn options, you can play against the computer. Here are the rules for solitaire play:

  1. The computer always scores first. At the beginning of every round, the computer plays randomly until at least one point is acquired. Press the plus key for the computer’s turn. You must continue passing (skip your turn with the minus key) until the computer puts points on the board.
  2. After the first score by the computer, you can begin to play. When the computer has a turn, press the plus key for a random move.
  3. Whenever you make points, you must pass again until the computer scores. When the computer gets more points, you can begin to play again. This rule means you should hold back on the easy scores of a few points; wait until there’s an avalanche available.
  4. If you’re the first to reach the goal, the computer gets a last chance. Don’t make this move randomly; figure out the best opportunity for scoring and play that move for the last-chance turn.

In the interest of keeping these programs to a manageable length, no attempt has been made to provide an “intelligent” computer opponent. Once you become familiar with the game, you might find it an interesting project to try adding some routines that give the computer a rational basis for picking one move over another.

Editor’s Notes:

  • This is a great two player game! It takes a few turns to figure out what’s going on, but once you do, the game becomes very strategic. There are also rules for playing against the computer in a solitaire mode. Note that this program includes no intelligence for the computer, so the computer’s plays are based on randomness (it’s still fun!)
  • Todd Heimarck was an Assistant Editor at COMPUTE! at the time this game was published (March, 1986). He’s credited for a number of other games and programs that appeared in COMPUTE! magazine.
  • It was originally written for the Commodore 128 and ported to other platforms, including the C64.
  • If you are typing this program in, it’s strongly recommended that you use COMPUTE!’s New Automatic Proofreader.

Watch Switchbox get typed-in and played

About eboy71

eboy71, or Bryon as he's known IRL, grew up in the 80's, bathed in that warm monitor glow from his Commodore 64. He enjoys preserving programs from the computer magazines of his youth, especially COMPUTE!, and still manages to get in a game of Impossible Mission from time to time.

Leave a Reply

Your email address will not be published. Required fields are marked *