Tallyx is our arithmetic maze. Open grid, no walls: every cell carries an operation - +4, −3, ×2, ÷2, %7 - and you walk a carried number from the start cell to the amber exit ring. The door opens only if you're holding exactly the target. Easy to describe. Weird to generate.
How it plays
You start on the edge of the grid holding a small number. Every step onto a neighbor applies that cell's op to your number. Stepping back onto the cell you just left undoes the step; walking home to the start resets everything. There are no wrong cells, only wrong values - and the only hard constraint is the move budget counting down in the corner.
Now the generator's problem. A board like that needs a target number the player can actually hit, and the question is where the number comes from. How do you pick an answer before the puzzle exists?
The obvious design: pick a target, scatter ops, run the solver to check it's reachable. We tried it. Most candidates either couldn't reach the number at all, or reached it in three steps through cells that happened to cooperate - the solver spent its whole budget answering a question we should never have asked. So we flipped the pipeline. We don't choose the answer. We compute it.
Step 1: the golden spine
Every board starts as a self-avoiding walk: a random edge cell, then exactly the level's path length in steps that never revisit a cell, ending wherever they end. That last cell becomes the exit. Two rejections happen here already - a walk that dead-ends early gets scrapped (up to 60 tries), and an exit that lands adjacent to the start gets scrapped too, because a two-step maze is a hallway.
The spine is the solution. Whatever else lands on the board, there is always one legal walk from start to exit, and we know every cell of it.
Step 2: deal the ops, read the answer
This is the part that's backwards from how puzzle generation usually works. We roll a start value between 1 and 9, then deal one op onto each spine cell and simulate the walk: start at 4, step on +5, you're at 9, step on ×2, you're at 18, and so on to the end. Whatever number survives is the target. The equation is authored forward, never guessed backward.
The simulation bails and re-deals when the math gets ugly: intermediates past ±500 (beyond that the arithmetic stops being readable at a glance), targets past 300, any negative before level 28 unlocks them, and zero-sum paths where start and target are equal. Start 7, end 7 - nothing happened, algebraically and emotionally. Up to 40 deals before we scrap the whole board and re-walk.
One more rule once multiplication exists: if the spine rolls only + and − ops, we re-deal. A level 20 board whose golden path is all addition wastes the machinery the player just unlocked.
Step 3: decoys from the same deck
Every cell off the spine gets an op drawn from the same pool, so nothing on the board marks the intended route. The odds shape the texture: +/− cells are the pavement (favored slightly toward +), ×2/×3 show up about 46% of the time, ÷2/÷3 at 24%, and %4-%9 at 10% - the code comment says they're "the heavy machinery, not the pavement," which is exactly right. Division is floor division, by the way. 7÷2 is 3, and 3 never finds out it used to be 7.
Step 4: reject the stroll
A solvable board can still be boring: sometimes a decoy next to the exit is ÷2 and another decoy feeds it a clean 40, and your 15-step spine becomes a 4-step walk in the park. The last gate catches that. The solver does a breadth-first search over (position, previous cell, carried value) - stepping back onto your predecessor is a backtrack in the real rules, so those edges are skipped, which keeps the search small. If any walk reaches the exit holding the target in under 60% of par, the board is rejected.
60 attempts per level. If nothing passes, we keep the first candidate anyway and drop the gate - still solvable through the spine, just possibly a gift. An honest compromise, logged and shipped.
How the difficulty actually scales
Ops arrive on a schedule, not all at once: subtraction at level 4, multiplication at 9, division at 15, modulo at 22, negative targets at 28. Boards grow 4×4 to 8×8 and operands stretch from 1-5 up to 1-9, but the target ceiling stays 300 - so the late game is about planning a route, not doing big arithmetic in your head. The move budget rides along at par plus slack, which means the real question a level asks is how many detours you can afford.
What we'd tell another dev
Author the solution forward and read the answer off the simulation. Then spend the solver's time on the only question left: is this too easy? Verification is cheap when you already know the answer is reachable - the expensive question was never solvability, it was dignity.
How to actually win
- Check the cells next to the exit first. The last step is the only one that has to land exactly, so knowing it narrows everything before it.
- Revisiting a live trail cell re-applies its op. Annoying when it ruins your number, handy when you actually want ×2 twice.
- Walk home when the value is ruined. The start cell resets the number and clears the trail - it costs moves, and it saves the level.
- Notice the unlock banner. When × or ÷ joins the pool, the next few boards lean on it hard, because the generator is told to make sure they do.
Where it differs
Math mazes are an old print genre - you can find them in puzzle books, and nearly all of them pick the answer first and hope the grid cooperates. Tallyx generates the equation and reads the answer out of it, which is why every level is solvable by construction and only ever rejected for being too kind. One more thing the trail does that the books can't: every cell you've walked prints the equation it applied, so the board itself is your undo map.
Tallyx is free on Google Play - offline, 28 languages, one optional rewarded ad if you want to retry a failed level.