Can you hack the computer and save the world?
Be a spy in CODE IV, January’s ZX81 program of the month, a retro take on computer cracking.
“Agent 51, your goal is within reach, but there is a problem.”
“Understand,” you reply. Professional as always, you only allow a hint of annoyance in your voice. “Explain.”
“Well, the plans are in the room in front of you, but the floor is a trap. You need to deactivate it using the terminal to your right.”
You look down at the screen, a singular “READY” stares back at you.
“Sounds easy enough,” you reply.
“It isn’t. The interface is protected and, sadly, our operative died before he could tell us the code.”
“So what do I do?”
“You’re going to have to hack it. Our operative left a back door into the system, if you can find it. You can do it, Agent 51.”
You nod at the voice in your ear. You can do this.
Play begins with imagination.
Computers are great for role playing and Code IV was one of my programs that helped enable a story. As a kid, I often augmented my play using my ZX81. Although the narrative above isn’t exact, it embodies what I was thinking when I wrote this month’s ZX81 program. Fun, adventurous, and unfair, can you crack the code and disable the floor?
But first, lets talk code.
Before I dig further into the game play, and spoil your fun, I want to discuss the code. First off, I modified the code a lot from the original. Looking at the original, it is obvious that I threw together Code IV in a hurry. There are plenty of bugs and, in one case, the program is broke. Although okay when writing some code to compliment game play, it isn’t something I could share as is. So I modified it.
Most of my changes were to correct bugs and help make the program flow better. In one case, a missing
SCROLL command would break the program altogether. There was also a bug at the beginning where it kept displaying help text when it shouldn’t. That bug opened up a few other problems that I had to fix.
Without spoiling the game play, I broke the program up into sections that were distinct. The original version seemed to have the same breaks, but the flow was all wrong. In this one, I cleaned up the flow and made the sections more distinct.
Besides fixing the flow, I also cleaned up the command entry using a series of
GOTO commands. Although not as clean as I’d like, the code works better and it is more clear where you are in the program.
To finish up, I also added more commands and better text messages. The state of the floor is now saved, allowing me to display better messages when you act on the floor. Although subtle, the program benefits from these changes. I could have done more, but there wasn’t much point.
One thing I liked from the original program was that I obfuscated the hint. Although I never thought I’d share the original program, it didn’t stop me from hiding the secret command using
CHR$. Sure, anyone knowing ZX81 BASIC can piece it together, but you have to put a little work into it.
110 IF A$(1)=CHR$ (49) AND A$(2)=CHR$ (42) AND A$(3)=CHR$ (60)
AND A$(4)=CHR$ (46) AND A$(5)=CHR$ (56) THEN GOTO 130
A bad interface can turn you off.
The funny thing about old computers is that they were rather obtuse. The ZX81, as an extreme example, displays a simple inverse K when you boot it up. Other computers of the time weren’t any better. Some might display a somewhat helpful comment at the top, but otherwise you had to do something to make them go.
This is far cry from today’s computers with their flashy interfaces and intuitive apps. Pretty icons invite you to click and try things out. But the ZX81 was pretty much a calculator that you had to enter data in before it did anything. It could do a lot, but not without entering or loading a program first. Not fun.
Code IV plays on this by making the program look like an obtuse computer terminal. The generic READY prompt at the top isn’t very helpful. But, the goal is to get you to type something. You may not type the right thing, but that’s okay. The goal is to get you started.
The original game wasn’t very helpful at all. In fact, it is almost impossible without stopping it and figuring out what line 110 did. In this modified version, you don’t have to go to that much trouble. I added some hints.
If you are still stuck, look for the inverse words. Oh, and try a few different things, including trying them a few times. I added a little counter in the program that gives you another hint after a few mistakes.
As I noted, Code IV isn’t a stand along game. As such, it may be a bit of a let down after you’ve figured it out. The real fun was imaging a story around it, much like the intro did.
Sure, I could have created put some of that depth into the program, but I don’t think it would have been enough. Instead, it does what it needs to further play. With the tweaks I made, it works as expected and lets you enjoy your role playing.