Clark Lavery

Clark Lavery

Web, Games & Graphics Programmer

Brainmill

Brainmill

Five memory games · 2026

Five quick memory games for numbers, patterns and shapes. Each one is a single round you can play in a few seconds, and each gets harder as you do. They began as something to do between sets in my gym tracker, and Brainmill is the same games on their own.

How it plays

  • Digit Span and Reverse Span. Memorise a number, then type it back, or type it back backwards. Long numbers are spaced into blocks, and the answer slots keep the same spacing, so the chunks you learnt still hold.
  • Spot Check. Glance at a grid of shapes, and only once it's gone does the question arrive: how many shapes were sky blue, which colour came up most. The wrong answers are one either side of the right one, because that's how you actually get it wrong.
  • Afterburn. Hold a pattern of cells, then tap it back in. At higher levels the cells have shades, and a tap cycles through them, so it stays a one-handed game.
  • Circuit. A run of shapes plays one at a time, then you pick it out of four near misses: neighbours swapped, or a shape changed, the ways a run is actually misremembered.
  • One dial for every game. The same − and + control sets the level in all five, whether a level means more digits or a bigger grid. Play is untimed, or against a 90-second round clock.

How it's built

  • Every game is a pure state machine. A game is made from a seed and folds each input into a new state, with no timers or randomness outside that state. Saving a game is just storing the state, so a round picks up exactly where you left it.
  • Circuit can't be solved by comparing the options. Three variants of the true run would give it away, as the one option a single change from all the others. So all four, the truth included, are built one change from a hidden run, and nothing in how they relate marks the right one.
  • One game, two hosts. A game never knows what a rest timer is: it asks its host how long is left and whether time is up. In the gym tracker the answers come from the rest between sets; here they come from the round clock. The same components run in both, with no branching.
  • A second app in the same repo. Brainmill is its own SvelteKit app that imports the gym tracker's games rather than copying them, so a change to a game ships to both. Every page is prerendered, and it's served from Cloudflare as static files, with no server and no database.