Hangman is a good game wrapped around a picture of an execution. Replacing the picture turned out
to be the easy part.
The guessing game underneath hangman is close to perfect. One rule, no equipment, works from age six to ninety, and
the tension builds by itself. What it has instead of a scoreboard is a drawing of a person being hanged, assembled
one body part at a time as you fail. On a site full of games for children that is not something you keep and it is
not something you can quietly restyle. It has to be replaced by something that does the same job.
Which meant working out what job the gallows was actually doing.
One axis for everything
In hangman the information is split in two. Your progress lives in the row of blanks at the bottom; your danger lives
in the drawing above it. They are in different places, in different visual languages, and you learn to read both.
Fig Climb puts both on the same line. A chimp is on the trunk of a tall tree. Correct letters move him up toward a
cluster of figs at the top. Wrong guesses slip him back down toward the ground. Reach the figs and you have won;
reach the ground and the round is over.
Everything a player needs to know is now the chimp's height. How well am I doing, how much trouble am I in, how close
is this to over — one glance, one number, no reading. On a phone that matters more than it would anywhere
else, because the vertical space you have is the scarcest thing on the screen and you cannot afford to spend it
twice on the same information.
The losing state is the chimp sitting at the base of the tree, looking up at the figs he did not reach. Disappointed,
not dead. That is the whole point of the exercise.
Why a fig tree
The tree had to be tall enough to make six rungs of climbing look like a real journey, and the thing at the top had
to read as a prize at thumbnail size. Several candidates fit. Mangoes get to thirty or forty metres and the fruit is
instantly recognisable. Jackfruit has a certain appeal purely because the payoff at the summit would be absurdly
large. Breadfruit and durian are tall enough but few children would know what they were looking at.
Figs won because they are the true answer rather than a convenient one. Wild figs are among the most important foods
there are for real chimpanzees — troops will cross their range to reach a tree that is fruiting, and
researchers have studied how chimps judge from a distance whether a particular fig is worth the trip. Many fig
species are enormous forest trees, twenty to thirty metres, and the stranglers grow tall dramatic trunks that look
like something built for climbing.
So the answer to "why is this chimp climbing" is not "because the game needs a ladder". It is the same reason an
actual chimpanzee would. The clusters of small round fruit also happen to make a clearer goal at the top of a phone
screen than a single large one would, which is the sort of coincidence you take gratefully.
Two budgets, one line
Here is the part that is less obvious than it looks. If the chimp's height carries both progress and danger, then two
different counters have to drive the same position, and they do not agree about how many steps there are.
Wrong guesses are a fixed budget — six by default. Correct guesses are not: a word with four unique letters
takes four right answers to finish, and one with nine takes nine. If both used the same step size, then either short
words would send the chimp shooting past the figs on the third letter, or long words would have him finishing the
word somewhere in the middle of the trunk with the fruit still out of reach.
So the two are decoupled. The upward step is derived from the number of unique letters in this word, so that
a clean solve arrives exactly at the figs — not near them, at them. The downward step is derived from the
wrong-guess budget, so that the sixth mistake puts him exactly on the ground. One axis, two independent scales, and
both of them land on the nose whatever word came up.
That is the kind of thing that is invisible when it works and looks like a bug when it does not, which is why it was
the first thing proved in a headless test — that the climb only ever goes up on a correct letter, that a
repeated letter gets no extra credit, and that both ends of the range terminate where they are supposed to.
The bug with actual stakes
Everything above is craft. This one was a genuine failure.
The game pulls its words from a shared manifest that the site maintains, and it was pulling from the wrong one
— the manifest of dictionaries, which carries definitions, instead of the manifest of lexicons, which carries
plain word lists. When the entry it wanted was not where it was looking, the loader did the polite thing and fell
back to the manifest's default.
The default was a Scrabble tournament word list.
Nothing crashed. The game worked perfectly. A children's hangman game was quietly serving words from an unscreened
competitive dictionary, which contains a great deal that has no business in front of a six-year-old, and it would
have gone on doing so indefinitely because every visible symptom was "the game works".
The fix was two parts, and the second is the one worth keeping. First, read from the correct manifest. Second, and
more importantly: if the children's list is missing for any reason, do not fall back to the general list.
Fall back to sixteen screened words compiled into the game itself.
Sixteen words is a bad game. It is a much better outcome than a good game with the wrong words in it. The instinct
that a fallback should preserve as much functionality as possible is right almost everywhere and exactly backwards
here — when the thing you cannot load is the safety property, the graceful degradation is to get smaller, not
to get looser.
The words themselves are hand-picked: six hundred and ninety-nine of them, screened one at a time, grouped into
themes, with the letter-frequency table used for difficulty computed from that corpus rather than from English in
general. A word list for seven-year-olds does not have the same letter distribution as a newspaper, and guessing
difficulty derived from the wrong corpus would be subtly miscalibrated in a way nobody could point at.
Two more, for the collection
The artwork did not appear. Every asset was in place, every path was right, the loader was fine. The skin was defined
and then commented out of the list of skins. I lost an afternoon to that.
Better: the game looked correct on my machine and broke on every other device. The skin selection was being read from
local storage, my development machine had one saved from earlier testing, and nothing else in the world did. The bug
was not in the code; it was in the fact that I was the only person who had ever run it before. Anything that
persists a preference is a place where you stop being able to see your own software the way a new player sees it,
and the only defense I know is to test in a fresh browser profile more often than feels necessary.
Small screen, few compromises
The layout question in a game like this is who gets the vertical space. The answer is the keyboard: it claims its
natural height first, and the scene takes whatever is left, capped so it stops growing on tall screens instead of
stretching into a cathedral.
The word being guessed and the status line sit on a translucent plaque overlaid on the base of the scene rather than
in a row of their own beneath it, which bought back about ninety pixels — roughly the difference between a
tree that reads as tall and one that reads as a shrub.
The chimp's position on the trunk is one CSS custom property. The core computes a number, sets it on the scene
element, and the stylesheet decides everything about what that means visually. The game logic never learns what a
pixel is.
And the sound follows the same axis as everything else: correct guesses play a note from a pentatonic scale whose
pitch rises as the chimp climbs, so the closer you are to the figs, the higher the game sounds. It is a cheap trick
and it works on people who have not consciously noticed it is happening.