How Arrow Puzzle levels are generated
Last updated:
Arrow Puzzle has no hand-made level list, yet every board is solvable and the same level always looks the same. This article explains the algorithm behind the game, step by step, for curious players and anyone interested in procedural puzzle design.
Design goals
The level generator was written with four requirements:
- Endless. There should be no last level in any mode.
- Reproducible. Level 37 on Medium should be the same board for every player and every retry, so players can compare notes and practise a board.
- Always solvable. No player should ever face a board where every arrow is stuck.
- Tunable difficulty. Each mode must feel different, not just bigger.
Everything happens in your browser in a few milliseconds when a level starts. No level data is downloaded.
Step 1: A seed for every level
Computers generate “random” numbers from a starting value called a seed. Arrow Puzzle computes the seed from the level number and a fixed number for each mode, and feeds it to a small, fast pseudo-random number generator. Because the same seed always produces the same sequence of numbers, the same level always produces the same board. That is what makes levels reproducible without storing them.
Step 2: Choose board size and arrow length
Each mode has formulas that grow with the level number:
| Mode | Board size | Max arrow length | Chance to keep going straight |
|---|---|---|---|
| Easy | 5×5, +1 every 3 levels, up to 9×9 | 3 → 6 | 45% |
| Medium | 6×6, +1 every 2 levels, up to 11×11 | 4 → 8 | 55% |
| Hard | 10×10, +1 every 2 levels, up to 14×14 | 9 → 16 | 22% |
The “chance to keep going straight” controls how arrows bend. A low value, as on Hard, produces twisting, snake-like arrows that are harder to read.
Step 3: Fill the board with random walks
The generator visits every cell of the board in a shuffled order. Whenever it finds an empty cell, it starts a new arrow there and grows it with a random walk: at each step it either continues in the current direction (with the probability above) or tries the other directions in random order, moving only into empty cells. The walk stops when it reaches a randomly chosen target length or gets boxed in. Walks of at least two cells become arrows; the last cell of the walk becomes the arrow head, and the direction of the final step is the direction the arrow will fly.
This produces a densely packed board quickly. The generator repeats the process up to 25 times with different sub-seeds and keeps the attempt that covers the most cells, stopping early once 85% of the board is covered. Dense boards are more interesting because almost every lane is shared.
Step 4: Make it solvable
A randomly filled board is usually not solvable: some groups of arrows block each other in a cycle. To detect this, the generator uses a simple and fast solver that exactly mirrors the game rules:
- For every remaining arrow, cast a ray from its head in its direction to the edge of the board.
- If the ray hits nothing, the arrow can escape: remove it.
- Repeat until a full pass removes nothing.
Any arrows left at the end are “stuck”. A key property of this puzzle makes the solver reliable: removing an arrow can only ever open lanes, never close one. So if the greedy solver gets stuck, no order of moves could have done better, and if it clears the board, the board is solvable.
When stuck arrows remain, the generator tries to repair them by reversing some of them – swapping head and tail so they point the other way – and runs the solver again. After eight repair rounds, any arrows still stuck are simply removed from the board. The result is guaranteed solvable before you ever see it.
Step 5: Tune difficulty by “deepening”
A solvable board is not necessarily an interesting one. If half the arrows are free at the start, even a large board is easy. So on Medium and Hard, the generator runs an extra optimisation step. It measures each board with two numbers from the solver:
- Rounds – how many passes the solver needs to clear the board. More rounds mean longer dependency chains.
- First free – how many arrows are free at the very start. Fewer means a harder opening.
These are combined into a score that rewards rounds and penalises initially free arrows. The generator then repeatedly picks a random arrow, reverses it, and re-scores the board. If the board is still solvable and the score did not get worse, the change is kept; otherwise it is undone. This kind of search is called hill climbing. Medium performs 60 of these steps; Hard performs 600, which is why hard boards so often start with only one or two free arrows and require long chains of reasoning.
Step 6: Set the clock and the budget
Finally, the time limit is calculated from the number of arrows actually on the finished board: a base time plus a fixed number of seconds per arrow (30 s + 6 s on Easy, 20 s + 4 s on Medium, 15 s + 2.8 s on Hard). Hearts and hints are fixed per mode. Because the budget scales with the board, a level with many arrows is not unfairly short.
How the Hint button works
The hint uses the same ray test as the solver. It collects every arrow that can escape right now and highlights one of them at random. It is never wrong, and because removing arrows never blocks others, following a hint can never lead you into a dead end.
Why this matters to players
- You never need to wonder whether a level is impossible – it was proven solvable before it was shown.
- You can safely remove any free arrow at any time; there are no traps where an early move ruins the board.
- Retrying a level gives you the same board, so you can learn from mistakes.
- Difficulty comes from structure, not from luck.
Want to put this knowledge to use? Read the strategy guide or play a level now.