Skip to content
Spectrum · BASIC · Game 09 BASIC ● 6 of 6 units live

Cipher

Guess the hidden word one letter at a time. The word list lives in DATA — change the data, change the game.

ZX Spectrum Cipher: an inverse CIPHER title bar, a partly-revealed word in green, a star lives bar, and the tried letters
What you will build: pick a hidden word, guess it letter by letter, and race your dwindling lives.

Cipher is a word-guessing game. The computer picks a word from a hidden list. You see dashes — one per letter. Guess a letter: if it is in the word, it appears. If not, you lose a life. Find the word before your lives run out.

This is the first game in Volume 2 — Patterns of State. Volume 1 taught how games communicate — with colour, sound, and timing. Volume 2 teaches how games think: how they store information, search it, and reason about it. The programs get more structured; the design questions get harder.

You arrive fluent. From Meet BASIC and Volume 1 you already have INPUT, strings and slicing, loops, the found-flag pattern, a lives counter, colour, sound, and even user-defined graphics. Cipher leans on all of it and adds two ideas of its own.

The first is writing into a stringd$(i TO i) = g$ drops a guessed letter into the revealed word at exactly the right spot. The second is data-driven content: the word list lives in DATA, and RESTORE plus a counted READ pick one at random. The logic never changes; change the DATA, and you change the whole game.

What you will build:

  • The reveal — read a word, show dashes, and slot in each correct guess by slicing (the new idea)
  • The rules of a round — a life lost on a miss, a win when the word completes, no wasted repeats
  • A board — an inverse title, the word in colour, a lives bar, the letters you've tried
  • A list of words in DATA, with RESTORE and a counted READ to pick one at random (the new idea)
  • Rounds — wins and losses tracked across games, with win and lose screens
  • The design concept: data-driven — the content shapes the experience

6 units. About 5–7 hours. This builds on Meet BASIC and Volume 1 — earlier games assumed.

Unit roadmap

Phase 1

The word

Reveal a hidden word, with lives, repeats, and a board

Units 1–3 Complete
Phase 2

A data-driven game

A list of words to choose from, and rounds to play

Units 4–5 Complete
Phase 3

The finished game

Custom graphics and a front door

Units 6–6 Complete