Watch the pattern, then play it back — one pad longer every round
← Back to Fun TimeThis 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/simon-rules.js | The rules: the sequence, the checking, the phases | addStep, isCorrectSoFar, pressPad, updateGame |
| lib/simon-draw.js | Painting the four pads | drawPad, padAtPixel, renderGame |
| lib/simon-main.js | The glue: clicks, keyboard, the loop | doAction, connectBoard, gameLoop |
💡 The big idea: the game is always in one of three phases — watching, playing, or over — and almost every rule starts by asking which one it is in. A little word like phase can organise a whole program.
🛠️ Want to be walked through it? Build Simon Says Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.