Trap or Gold Is a Simple ZX81 Game of Chance With a Twist


A ZX81 BASIC game of chance where you gamble with gold and health. Explore randomness, player psychology, and a single tempting treasure chest.

I was pursuing ideas for a simple role-playing or fighting game. The one I landed on was the concept of a single treasure chest. It fit the retro-computing theme perfectly. Trap or Gold is a simple game that doesn't need fancy graphics, speed, or memory — yet it’s still fun.

# From idea to fun.

Working on the game, I realized that simplicity was its strength. My ideas tend to be grand, graphic-heavy games that don’t always play well on the ZX81. To be honest, they don’t always look great either. Lately, I haven’t had the time to work on larger projects, so the idea of a single treasure chest that you either open — or don’t — felt right. It works.

Thinking about the game during a recent run, I realized how much it echoes the programs I wrote as a teenager. Once I figured out random numbers, my first games were usually dice or card games. Those are probably the simplest forms of chance you can create.

Trap or Gold, Starting screenshot, 2026 by Steven ReidTrap or Gold, Starting screenshot, 2026 by Steven Reid

What makes Trap or Gold interesting is that it isn’t just about winning or losing money. Most gambling-style games revolve around a single value — money. Here, you’re gambling with two: gold and health. You want gold, but you don’t want to get hurt. That extra layer adds tension and fits nicely with the fantasy theme.

# A little strategy.

Adding health makes Trap or Gold feel more like a survival game. Opening the chest offers risk or reward — wealth or pain. Under the hood, the game picks a random number using the line LET R=RND. The odds don’t change, but you are given a choice: open the chest or not.

Trap or Gold, Opening the Chest, 2026 by Steven ReidTrap or Gold, Opening the Chest, 2026 by Steven Reid

To make this more interesting, I intentionally generate the random number before you open the chest. This gives the player the opportunity to “burn” a number if they feel the chest might be a trap. Rationally, it changes nothing. Emotionally, it feels like control.

It’s a small trick, but it adds a surprising amount of tension. It turns a simple random number into something that feels personal.

# Making it a bit more random.

The ZX81 uses a pseudorandom number generator. By default, the sequence is the same each time the machine starts, which makes outcomes predictable. To avoid this, you can use RAND 0 to seed the generator from the FRAMES counter — a value that updates as the screen refreshes.

Trap or Gold, Deciding not to open the chest, 2026 by Steven ReidTrap or Gold, Deciding not to open the chest, 2026 by Steven Reid

On a real ZX81, this works well. The delay between turning on the machine, loading a program, and running it is usually enough to produce different results.

On an emulator, however, everything happens almost instantly. The machine state is consistent, and the random sequence can repeat each time you start the program. That’s not ideal for a game of chance.

Trap or Gold, Finding treasure, 2026 by Steven ReidTrap or Gold, Finding treasure, 2026 by Steven Reid

While designing the game, I added a simple title screen that waits for a key press. This gave me an opportunity. I moved the RAND 0 call to after the input. Since human timing is unpredictable, it helps make the results feel truly random.

# Making the game visually appealing.

To make the game a bit more interesting visually, I added a simple animation for opening the chest. This is done using a sequence of PRINT statements. To slow things down, I took advantage of the ZX81’s quirks — using small delays to create the illusion of motion.

Here’s the code with simplified graphics:

2500 REM **OPEN CHEST**
2510 PRINT
2520 PRINT AT 9,14;"_____";AT 10
,14;"<pipe>___<pipe>"
2530 LET L=SIN PI**PI
2540 PRINT AT 9,14;"<pipe>---<pipe>";AT 10
,14;"<pipe>---<pipe>"
2550 LET L=SIN PI**PI
2560 PRINT AT 9,14;"<pipe>---<pipe>";AT 10
,14;"<pipe> <pipe>"
2570 LET L=SIN PI**PI

I use a similar approach for the trap and treasure animations. With just two frames and a simple loop, you can create a flicker effect that works surprisingly well:

2640 PRINT AT 21,6;"   TRAP/ -";
D;" HEALTH "
2650 FOR P=1 TO 10
2660 PRINT AT 10,15;"***"
2670 LET L=SIN PI
2680 PRINT AT 10,15;"---"
2690 LET L=SIN PI
2700 NEXT P

Trap or Gold, Finding a trap, 2026 by Steven ReidTrap or Gold, Finding a trap, 2026 by Steven Reid

# Open the chest?

In the end, Trap or Gold is an adventure wrapped in a game of chance. I enjoyed developing it, and I’m happy with how it turned out. It feels like something I might have written back in the eighties.

Trap or Gold, Finding enough gold, 2026 by Steven ReidTrap or Gold, Finding enough gold, 2026 by Steven Reid

I played through it multiple times to capture screenshots, and along the way, I found myself developing strategies — or at least convincing myself that I had one. Trusting instinct, second-guessing outcomes, and hoping for gold instead of traps made each decision feel meaningful.

As your health drops and your gold creeps toward 100, the tension builds. In the end, it isn’t really about the numbers — it’s about the feeling that maybe, just maybe, this time you’ll get lucky.

So… do you open the chest?

---

Want to try it out? You can run the program, or view the code if you’d like to see how it works.



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