I got for my birthday a cool wodden puzzle box. The very first puzzle that has to be solved is a sliding panel puzzle. A move consists of either

  • Pushing one of the six smaller wodden boxes up or down
  • Twist the whole top ring clock or counter clockvise

It is a bit back and forth twisting until all the boxes are at the end position. Recreating the puzzle is trivial with just some colliders and corresponding images.

But I'm clueless on how I would approach to generate a maze dynamically like this (just the path).

enter image description here

  • \$\begingroup\$ When you say generate the maze dynamically, do mean the open spaces that the dark wooden pins travel through as you unlock it? \$\endgroup\$
    – Pikalek
    Commented Jun 25 at 1:51
  • \$\begingroup\$ Yes, I mean the open spaces - the path of the pins \$\endgroup\$
    – Zibelas
    Commented Jun 25 at 5:15
  • \$\begingroup\$ It might help to include a video of the mechanism being operated, or a step-by-step diagram, as it's not so obvious from a single still for folks who have not seen this puzzle before. \$\endgroup\$
    – DMGregory
    Commented Jun 25 at 11:15

1 Answer 1


This puzzle can be equivalent to a set of gridded mazes. For each maze, the player can move up and down freely, but must move left and right synchronously. Then the sub-puzzle shown in the figure can be equivalent to a 2D grid maze like this:

enter image description here

For simplicity, we assume that all wodden boxes are 1x1 squares. The width and height of each maze can be different, but the x-axis distance from the starting point to the end point of all mazes must be the same(because all players in the maze move left and right synchronously).

Goal is to generate several mazes like the following figure, and ensure that each of them has a solution:

enter image description here

There are two common methods to generate puzzles, which to be used depends on the needs:

  1. Generate a puzzle randomly according to some certain rules and automatically test whether there is a solution. First generate some mazes with separate solutions, and then test these mazes together. During the entire testing process, you can regard the current state of all mazes as a node and a feasible operation(e.g. move left,move right,maze1 move up,maze2 move down) as an edge. Then this problem is transformed into a graph traversal (spanning tree) problem. The player's position in each maze can be encoded and saved to prevent going to a node that has already been passed during the search process. In this process, a heuristic function can be added to speed up the search.

  2. First randomly generate a feasible path, and then generate obstacles along this path. It is the opposite of method 1. First, we continuously initiate feasible operations(e.g. move left,move right,maze1 move up,maze2 move down). All players start from the starting point and walk freely in the unobstructed n*m maze until all players reach the end. This also requires the use of a graph traversal algorithm to avoid the state falling into a loop. Record the full path walked by each player, and for each maze, keep this path and set all other grids as obstacles.

The test pass rate of method 1 is predictably very low, so I personally recommend method 2. It is not easy for method 2 to produce high-quality results in a single 2D maze, but this puzzle is designed to allow players to observe back and forth between different mazes, so the quality of a single maze is not that important.

Finally, we can use the 2D maze data to generate a 3D model of the disk. But this is another topic.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .