!header Calcudoku Generator
!begin-text-block
Calcudoku is a variation on Sudoku — given an \(n \times n\) grid, fill it with the digits \(1, ..., n\) so that no row or column contains a repeated digit, and so that every cage’s condition is satisfied. A cage with 5+ in a corner needs its contents to sum to 5, for example. A 2- cage is a little more complicated — it means that choosing some cell in the cage and subtracting the others results in 2 — so a 3-cell cage containing 5, 2, and 1 would work, for instance. Division cages are written with a colon and work the same. Finally, some cages have no operation at all. They’re always \(1 \times 1\), and simply contain the number in their corner.
The core of the algorithm is written in a language called WebAssembly that runs much faster than JavaScript — the standard language of the web — but even still, generating these puzzles takes time. They’re built by successive modifications that each make the puzzle slightly harder, so the longer you wait, the more challenging the final result will be. For the best results, let the program run for five to ten minutes and make some tea. It’s not too much to ask — after all, you’re probably going to spend longer than that actually solving the puzzle.
This applet was made with Wilson, a library I wrote to make high-performance, polished applets easier to create.
!end-text-block
!begin-text-boxes
grid-size 6 Grid Size
max-cage-size 2 Max Cage Size
!end-text-boxes
!begin-text-buttons
generate Generate
!end-text-buttons