Damian Walker

Personal Web Pages

Hunt the Wumpus in Tiny BASIC

Hunt the Wumpus

Thursday, 8th August 2019

Since I started researching Tiny BASIC, I have found that program examples aren't as plentiful as I'd hoped. Most of the examples I have found use one of the expansions to the language, and require such things as a random number function (RND) or array handling. So it looks like I'll have to generate some project myself. Naturally, it will be some kind of game - it's not as if you can do anything much more useful in Tiny BASIC.

One big limitation is still that data is integer variables only; the lack of strings and arrays means that some games are just not possible. But I found one that should be achievable: Hunt the Wumpus.

Hunt the Wumpus is a simple text-based game in which you explore a cave system. Unlike most adventure games, you don't explore my moving north, south, east and west. Which is just as well as you can't input such commands in Tiny BASIC. Instead, the cave system is a network of linked rooms each with a number. You enter the number of the cave you want to move to. That sounds ideal for Tiny BASIC.

The biggest challenge is in keeping track of the paths between the rooms without the use of arrays. This is where the computed GOTO comes in. There are only twenty rooms in the game, and each has three exits. So a set of twenty very small routines can set three "exit" variables according to which of the routines is called. It's a bit tedious, but it should work. If I wanted to be really clever, I could use some kind of base-20 calculation to store the three exits in a single integer.