Skip to content
mattix

somdoku

TypeScript, React · live at somdoku.nl · mattijsf/somdoku

A daily Japanese sums puzzle for mobile. Everyone gets the same puzzle each day. The score is the time it took, shared as an emoji grid like Wordle. English and Dutch, picked from the browser language.

Terminal window
git clone https://github.com/mattijsf/somdoku.git
cd somdoku
npm install
npm run dev
Somdoku preview card with a partly filled 4 by 4 grid and edge sums

The site’s link preview image.

A 5×5 grid. Every row and column holds the digits 1 to 4 once and one black cell. The numbers along the edge are the sums of the groups of digits between the black cells, in order.

inputdate
The player’s local date, for example 2026-11-25.
inputseed
An FNV-1a hash of the date seeds a mulberry32 PRNG. Same numbers on every device.
src/lib/puzzle.tsgenerator and solver

Generate and test: build a random solution, derive the edge sums, and solve from the sums alone. A grid the solver can’t finish, or finishes in the wrong number of rounds, is dropped and the next attempt starts, up to 20,000 per seed.

  1. random solution
  2. edge sums
  3. solve from sums only
  4. keep or retry
src/featuresscreens
Ready, play and done. There is no check button: the game ends when the grid is right.
zustandstate
Game and UI stores, persisted in localStorage. The streak is counted from stored games.
src/sw.tsservice worker
Caches the app for offline play and install. Fetches fresh when online.

You can’t tell whether a grid makes a good puzzle by looking at it. It needs exactly one answer, and you should be able to reach that answer by working through the rows and columns without guessing. The only way to find out is to try solving it.

The game picks a random filled-in grid, works out the sums along the edges, and gives only those sums to a solver that reasons the way a person would. If the solver gets stuck, the grid goes in the bin and the game picks another one.

About one grid in six makes a fair puzzle. A day’s puzzle usually takes a dozen or so tries, well under a millisecond in the browser. The worst day I found in a year of dates needed 404 tries and 12 ms.

I could have done this ahead of time instead. There are only 161,280 possible grids, and solving all of them takes about three seconds. But then every visitor would download a list of 26,468 puzzles to save less than a millisecond.

The solver also tells me how hard a puzzle is. It goes over the rows and columns in rounds, filling in what it can each time, and the number of rounds it needs is the difficulty. The date picks a level of 3, 4 or 5 rounds, and the game keeps drawing grids until one matches. The hard ones are rare: only 1,468 grids need five rounds or more.

The date is hashed (FNV-1a) and used to seed a small random number generator (mulberry32). Every phone draws the same grids in the same order and lands on the same puzzle. No server is involved, and the game works offline. Changing the generator, or even the seed text, changes every day’s puzzle.

When you share a result, you get your time and a block of green and yellow squares, one per cell, in the order you filled them in. Green means you never touched that cell again, yellow means you changed it later. The squares don’t show where the cells are.

No trackers or cookies. Older designs of this site.