Box-Pushing Puzzle Generator
In a box-pushing puzzle you walk around a walled floor and push boxes onto target squares. You can only push, never pull, and only one box at a time, so a box shoved into a corner is lost for good. Most boards drawn at random cannot be solved, or are solved by pushing in a straight line, so these are built backwards: starting from every box on its target, every position that can be reached by pulling boxes is searched, and the board printed is one of the positions furthest from solved. That search is exhaustive, so the number of pushes printed under each board is the fewest possible — and it is checked again by a separate forward search from the printed board, which also replays the printed solution move by move. You can also type in a board of your own to find out whether it can be solved.
What this generator does
Builds small walled boards with boxes and targets that are proved solvable, states the fewest pushes each needs, and prints a solution separately; it also checks boards you type in. The sliding puzzle generator scrambles tiles in a frame; here pieces only move when pushed, and a wrong push can make a board impossible, which is what the planning is about.
How to use this tool
- Choose a board size, how many boxes, and how many boards to print.
- Press Make the boards and wait while each board is searched.
- Read the measured counts under the result: the fewest pushes for each board and the length of the printed solution.
- Print the boards and the solutions, which come on a page of their own.
- To check a board from a book or your own design, choose Check a board I have typed and type it in the usual notation.
Understanding the controls
- Board size
- A floor of 5 × 5, 6 × 6 or 7 × 7 squares inside the outer wall, with some squares turned into walls. A bigger floor usually means more pushes, not necessarily a harder idea.
- Boxes on each board
- One to four. More boxes get in each other’s way, and the search grows quickly: four boxes on the large board can take several seconds a board on a slower device.
- How many boards
- One to six. Boards print two to a row; the solutions follow on their own page.
- Seed
- The same seed, board size, number of boxes and number of boards make the same boards and solutions again while the generator is unchanged.
- Check a board I have typed
- Type a board with # for walls, a space for floor, . for targets, $ for boxes, * for a box on a target, @ for you and + for you on a target. The board is checked for one keeper, as many boxes as targets and a floor closed in by walls, then searched for the fewest pushes.
Worked examples
- Seed warehouse, small, 2 boxes, board 1
- A 5 × 5 floor with four inside walls; the fewest pushes is 9 and the printed solution takes 28 steps. The same board is the sample in Check a board.
- Seed warehouse, large, 4 boxes, board 1
- Fewest pushes 22, proved after the backward search visited 33,152 positions; the printed solution takes 52 steps.
- A board with no solution
- A box in a corner of the room that is not a target can never move again, so a typed board starting like that is reported as having no solution, with the number of positions searched.
Common use cases
- A page of planning puzzles for a train journey or a wet afternoon
- Thinking ahead in a maths or computing club: why one push in the wrong place makes a board impossible
- Testing whether a board you designed can be solved, and in how few pushes
- Solving races between two players with the same seeded boards
How this generator works
A floor is drawn first: a square room with some inside squares turned into walls, keeping the floor in one piece and leaving no dead-end square walled on three sides. Targets are placed, the boxes are put on them, and a breadth-first search then pulls boxes back from the solved position — a pull is a push run backwards — visiting every position that can be reached, with walking about free and each pull counting one. The positions reached last are those that need the most pushes to solve, and one of them becomes the starting board. Several candidate boards are made this way and the one needing the most pushes is kept, with more changes from one box to another breaking a tie. The fewest pushes are then found again by a separate search running forwards from the printed board, never pushing a box onto a square from which it could not reach any target, and that search writes the solution, walking you by the shortest route to each push. Finally the solution is played move by move under the rules and must finish with every box on a target.
Randomness and fairness
The walls, the targets and the choice among the hardest starting positions come from one repeatable sequence started from the seed, and each board in a set uses its own number with the seed. When no seed is typed a new one is drawn from your browser’s secure random source and shown. The sequence is for reproducibility, not cryptographically strong, so the seed keeps nothing secret.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- The usual rules: you move one square up, down, left or right; walking into a box pushes it one square if the square beyond is free floor; boxes are never pulled and never pushed two at once.
- Any box may go on any target.
Limitations and good to know
- Difficulty is not graded. The page reports measured counts — fewest pushes, solution length and changes of box — and those are not the same thing as how hard a board feels.
- Only the number of pushes is proved to be the fewest. The solution printed is one of possibly many, and nothing here claims a board has only one solution.
- Boards are small: up to a 7 × 7 floor and four boxes, so every position can be searched.
- A typed board is searched up to 400,000 positions. Beyond that the page says it could not decide, rather than guessing.
- The boards are generated, not designed by a person, so they have no theme or intended trick.
Common mistakes
- Pushing a box against a wall with no target along it
- A box against a wall can only slide along it. If no target lies on that wall, the board can no longer be solved; start again.
- Reading the step count as the fewest steps
- Only the number of pushes is proved to be the fewest. The printed solution walks by the shortest route between pushes, but a different order of pushes might need fewer steps overall.
Practical tips
- Work in pencil and mark each box’s position lightly; it is easier to undo a push on paper that way.
- Before the first push, look at which target each box can still reach.
Privacy and your data
Boards are made and typed boards are checked in your browser; nothing you type is sent, saved or put in the page address. The site’s counters record only that boards were made or a board was checked, and a count — never a board.
Frequently asked questions
- How do I know every board can be solved?
- Each board is made by pulling boxes back from the solved position, so a way back always exists. It is also checked from the printed board: a forward search finds the fewest pushes again, and the printed solution is played move by move and must leave every box on a target.
- What do the letters in the solution mean?
- u, d, l and r are steps up, down, left and right. A capital letter is a step that pushes a box. Groups of five are only for reading.
- Can it tell me whether a board from somewhere else can be solved?
- Yes, if it fits in 20 × 20 squares: choose Check a board I have typed. It says solvable with the fewest pushes and a solution, no solution after searching every position, or not settled when the search reaches its limit.
- Is the solution the only one?
- No claim is made. Most boards have several ways to finish, and the page only proves how few pushes are needed.
Related generators
- Sliding Puzzle GeneratorScrambled 8- and 15-puzzles that are guaranteed solvable, with the shortest solution length found by search on the smaller board.
- Maze GeneratorPrint a maze with exactly one route from start to finish — three textures on a square grid up to 40 by 40, or the same maze laid onto hexagons, triangles, rings or a picture outline up to 26.
- Tower of Hanoi SolverThe complete optimal move list for any number of discs, replayed against the rules and checked against the two-to-the-n bound.
- Nonogram GeneratorPrintable nonograms whose clues are proved to have exactly one solution, and to be solvable without guessing.