September’s Program: Odyssey

Shut down the memory cores in this simple ZX81 game.

[Odyssey 1984]This month I present another simple game, Odyssey. It doesn't include instructions, so here is a quick synopsis. An evil computer has trapped you in a space ship. To escape, you have to remove the memory boards in order to shut down the computer. Sounds familiar? Obviously this program was inspired by 2001: A Space Odyssey. To play, use “Z” to move left and “.” to move right. Hit the “M” key to remove a memory card. Try to remove all of them in time to beat the computer.

This program is almost identical to the original version. My emulator crashed during writing of this, so I got lazy when retyping it. As such, the printing of the memory cards is a for loop instead of three lines of graphics. Note that in many of my programs I don’t use print loops as they can be much slower than printing a block of graphics. However, in this case it doesn’t matter. I also found and fixed a minor bug. When you restart the game, the screen doesn’t clear causing the graphic cards to display incorrectly. I also removed a number of GOTO statements and replaced them with GOSUB. None of the above tweaks changed game play. One change that did was a FOR loop that gives you 50 chances to move and remove a memory card. I found the game was almost impossible to loss at, so I decided to cut the loop in half. It is still pretty easy to win, but the first run should be more challenging.

Probably the most interesting feature of this program is the use of a string to manage the pattern to beat. I don’t know why I used a static instead of random sequence to follow. At least it provided some interesting coding challenges. Every two numbers in the string represents a memory card to try and remove. In the FOR loop, I check the size of the string using LEN to determine how long the loop is. Because of this, it would be pretty easy to shorten or lengthen the pattern. I store the state of the memory cards in an array. The screen is 32 charters wide so I have to skip every other column to properly display the memory card removal. Since the string provides the screen location of the card, I have to calculate where in the state array that card is. Looking at the code, I'm not sure I would write this the same way today, but it works well in this context.

Overall, this is a simple game that is easy to master. Feel free to set the mood while playing by thinking of HAL talking to you as you remove cards. Even better, just pop in the movie while playing. You don’t own the movie? (lame) Fine, you can instead watch HAL's death on YouTube. Inspiring, huh?

Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive