Sixty hidden words, six lives, and one letter at a time
← Back to Fun Time_ I O N is not many words.This game is split into small library files inside funtime/lib/, and every function has a comment saying exactly what goes in, what comes out, and the algorithm in plain English. Empty any function out, read its comment, and write it yourself.
| File | What it does | Good functions to try re-writing |
|---|---|---|
| lib/hangman-rules.js | The rules: hiding the word, counting mistakes | maskedWord, isWordComplete, wrongLetters, guessLetter |
| lib/hangman-draw.js | The drawing that grows one line at a time | drawGallows, drawParts, renderGame |
| lib/hangman-main.js | The glue: the keyboard and the alphabet row | doAction, connectBoard, setUpGame |
💡 The big idea: work things out, do not store them twice. The number of lives left is not kept anywhere — it is counted from the guesses whenever it is needed. Two copies of the same fact can disagree with each other; one cannot.
🛠️ Want to be walked through it? Build Hangman Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.