A ZX81 Puzzle Makeover: No More INPUT Drama


I revisited a classic logic puzzle on the ZX81—this time with smoother controls and a better user experience. No INPUT prompts, just pure 8-bit fun.

This month’s program is a bit of a departure. It is a take on the classic "Wolf, Goat, Cabbage" puzzle. The twist is, I didn’t write this one. Instead, I decided to update it to make the interface a bit easier to use. Let’s dive into the code.

# The puzzle.

The puzzle isn’t too hard. You have a wolf, goat and a cabbage. The goal is to move all three across the river. The problem is you can't leave the wolf with the goat or it will eat it. Same for the goat and cabbage who can’t be left alone with it. Fortunately, the wolf doesn’t care of the cabbage much.

Wolf, Goat Cabbage: starting the puzzle.Wolf, Goat Cabbage: starting the puzzle.

This ZX81 version of the puzzle comes from the book ”Computer Puzzles: For Spectrum & ZX81,” by Ian Stewart & Robert Jones. Written in 1982, it came out right as the Spectrum was released which is probably why it still had ZX81 programs in it. Sadly, the ZX81 version wouldn’t be able to take advantage of the user defined characters that the Spectrum did.

Wolf, Goat Cabbage: puzzle failed.Wolf, Goat Cabbage: puzzle failed.

# Wonky controls.

Although not as graphically interesting, the puzzler works well enough. But, for some reason, it used INPUT commands for the movement. To be honest, it is one of my least favorite ways to handle input on the ZX81. It breaks up the flow of the game and just doesn’t look great.

Wolf, Goat Cabbage: boat moving across the river.Wolf, Goat Cabbage: boat moving across the river.

As such, I decided to fix it! The program used variables to make it easier to read the code. I followed suit and added in two routines. One gets a key using INKEY$. The other waits for a key after the game is done. Both changes remove the clunky input method, making for a smoother, more natural experience.

# Easy to solve.

With the changes in place, the puzzle is much easier to play. You simply hit the key of the item you want to place in or take out of the boat. Hitting any other key sends the boat back. The overall program was quite fun to type in and the subtle changes make it just more enjoyable.

Wolf, Goat Cabbage: puzzle completed.Wolf, Goat Cabbage: puzzle completed.

Sadly, once you figure out the solution there isn’t a lot of replayability. I’m sure someone could come up with an increasingly harder version of the puzzle. I’m happy with the small but meaningful changes I made.



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