Cipher
Guess the hidden word one letter at a time. The word list lives in DATA — change the data, change the game.
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 string — d$(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, withRESTOREand a countedREADto 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
The word
Reveal a hidden word, with lives, repeats, and a board
A data-driven game
A list of words to choose from, and rounds to play
The finished game
Custom graphics and a front door