Disassembly using breadth first and graphs: how the take-apart search handles positions it has already found

How a known assembly is taken apart: why its moves make a graph and not a tree, what the search keeps of each position, what it does with the moves that lead back to positions it knows, and what that saves on a burr that needs 98 moves to open

21 November 2026 · Sources: core/shapelogic/solve/disassembler.cpp, node_hash.cpp, disassembler_node.h and movement_analysator.cpp; counts from a copy of the search with counters added, run on puzzles from ShapeLogic's test files (ShapeLogic 2.0, MacBook Air M4, 32 GB)

Where this page fits

The Solver works on a puzzle in two stages. First it finds the assemblies: every way the pieces can fill the shape, with no thought yet of whether they can be put there. That is an exact cover search, done with dancing links, and is described in Puzzle Solving: Assemblies using Dancing Links and Dancing Cells. Then it takes each assembly apart, starting from the pieces in their finished places, to see whether the puzzle can really be put together and taken apart, and in how few moves.

Everything on this page belongs to the second stage, the disassembly. Each search here starts from one assembly that is already known and only moves its pieces. Which assemblies exist is settled before it begins.

Summary

  1. A tree or a graph?
  2. One link back
  3. Three fronts
  4. What happens to the other moves
  5. How many ways there are
  6. What the links keep in memory
  7. After the first separation
  8. The sliding and Panex solvers
  9. Where it comes from

1. A tree or a graph?

When the Solver takes an assembly apart, it starts from the assembled puzzle and looks for every move the pieces can make: one piece or a group of pieces sliding one or more units in one direction, or, when rotations are switched on, a quarter turn. Each move gives a new position: where every piece is and which way it is turned. The search is over when it reaches a position in which the puzzle has fallen into two parts. It wants the fewest moves that get there. Each part is then taken apart in the same way (section 7).

The obvious way to picture this is a tree. The assembled puzzle is the root. Every move from it is a branch, every move from the end of a branch is a smaller branch, and so on. Figure 1 shows why that picture is wasteful, even for a puzzle with only two moves. Move a can be undone, which leads straight back to the start. And when a and b move pieces that do not touch, making them in either order ends in the same position. After only two moves the tree already has the start twice and position C twice, and every copy would grow its own branches.

The moves as a tree every sequence of moves, two deep a b a′ b b′ a S A B S C S C S twice and C twice already, after two moves The same positions as a graph each position once, each move a line both ways a b b a S A B C four positions, four moves, nothing repeated
Figure 1. Left: the move sequences of a small puzzle, written out as a tree; dashed circles are positions the tree already has. a′ undoes move a. Right: the same four positions drawn once each, with one line for each move. A line can be followed both ways, because every move can be made backwards.

On a real puzzle the tree is hopeless. Pelikan Burr, designed by Dic Sonneveld, needs 98 moves before the first part comes out of its box. Its positions allow 12.8 moves each on average, so a tree of every sequence of 98 moves would have around 10108 branches at the bottom. Yet the whole search only ever meets 6,742 different positions.

So the search works on the right-hand picture, a graph: each position is a dot that appears once, and each move is a line between two dots. The fewest moves to take the puzzle apart is then the shortest route from the start to any dot where the puzzle has separated.

2. One link back

Each position the search finds is stored once. It holds:

Two positions count as the same when every piece lies in the same place relative to the first piece. Moving the whole puzzle, frame and all, by one unit does not make a new position.

The search is breadth first. It finds every position one move from the start, then every position two moves away, and so on. Each of these sets is a level. A position is therefore always found first by one of its shortest ways, and the link it gets then is the one it keeps. In this search the link never changes afterwards. The set that holds a level could replace a link if a shorter way turned up later, but none can: every position in a level is the same number of moves from the start.

All the links together form a tree, but a different one from Figure 1. It contains every position exactly once and follows only shortest ways. In graph terms it is a shortest-path tree. Once a separating position is found, the moves are read off by following its links back to the start.

3. Three fronts

While it works on level d, the search holds three sets of positions, each a hash table that finds a position by its pieces: the old front (level d − 1), the current front (level d) and the new front (level d + 1, as far as it has been found). It takes the positions of the current front one at a time. For each one, call it P, it works out every move, and each move leads to one of four places (Figure 2):

Old front level d − 1 Current front level d New front level d + 1 P back sideways found already new link back to the position it was first reached from a move from P; only the new one is kept
Figure 2. The three fronts while the search works on position P. Gray lines are the links back, one for each position. Of P's four moves, only the one to a new position adds anything. The others are recognized and dropped.

Why three levels are enough. A search like this usually keeps a list of everything it has ever seen, so that it never goes round in circles. This one needs only the three fronts, because every move it follows can be made backwards: a slide can slide back and a turn can turn back. Removing a piece is the one move that cannot be undone, and it ends the search, so it is never followed. Suppose a move from P, in level d, led to a position Q that was first found in some level k two or more levels earlier. Undoing the move would take Q to P in one move, which would put P in level k + 1 at the latest, not in level d. So Q can only be in level d − 1, d or d + 1, and the three fronts hold exactly those.

When the current front is through, the old front is let go, the current front becomes the old one, the new front becomes the current one, and an empty set becomes the new front.

Figure 3 runs the whole search on a small graph of positions. It shows every move tested against the three fronts, the one link each new position gets, the fronts moving on after each level, a dead end being freed together with the branch behind it (section 6), and at the end the moves read back along the links.

Animation: the take-apart search on a small graph of positions, with its three fronts, the moves sorted into back, sideways, found already and new, the links back, a dead end freed, and the path read back from the separated position
Figure 3. The take-apart search on a small graph of positions, move by move (47 steps, about 90 seconds at 1×, then it starts again). S is the assembled puzzle and in X the puzzle has come apart. The graph is made up to show every case; a real puzzle’s levels hold hundreds of positions. The arrows (or the arrow keys) go a step back or forward, and clicking the picture pauses or plays it.

Threads. When a level holds many positions, the search shares them out over the processor's cores. Each thread lists what its positions' moves lead to, without changing anything shared. The lists are then put together in the order a search on one thread would have made them. So every position gets the same link, and the take-apart comes out the same, however many threads ran.

4. What happens to the other moves

The short answer to "how does the search keep track of all the moves that end in positions it has already found?" is that it does not. Such a move is tested against the three fronts and dropped. The search never stores the lines of the graph, only which positions exist and the one link of each.

That is enough because of the question the search asks: what is the fewest moves to a separation? The shortest-path tree answers it, and the dropped moves could not improve on it. A move back or sideways leads to a position that already has a way at least as short. A move to a position found already offers a second way of the same length, never a shorter one. Questions that need the dropped moves, such as how many shortest ways there are or which positions are dead ends, would mean recording more. Counting the ways for section 5 meant adding a number to every position.

Figure 4 shows what becomes of the moves in Pelikan Burr, level by level. Of the 81,007 moves the search found, 25% led back, 47% sideways and 19% to positions found already. That last share includes the 3% where two moves of the same position led to the same place. Only 8% led anywhere new.

0 2,500 5,000 7,500 10,000 Moves found Level 0: 1 positions, 10 moves. New 10, found already 0, sideways 0, back 0 Level 1: 10 positions, 104 moves. New 43, found already 35, sideways 16, back 10 Level 2: 43 positions, 515 moves. New 123, found already 152, sideways 162, back 78 Level 3: 123 positions, 1,638 moves. New 110, found already 275, sideways 974, back 279 Level 4: 110 positions, 1,149 moves. New 61, found already 172, sideways 538, back 378 Level 5: 61 positions, 550 moves. New 35, found already 96, sideways 186, back 233 Level 6: 35 positions, 346 moves. New 47, found already 25, sideways 143, back 131 Level 7: 47 positions, 486 moves. New 76, found already 122, sideways 216, back 72 Level 8: 76 positions, 845 moves. New 59, found already 145, sideways 428, back 213 Level 9: 59 positions, 519 moves. New 52, found already 53, sideways 202, back 212 Level 10: 52 positions, 312 moves. New 31, found already 40, sideways 137, back 104 Level 11: 31 positions, 148 moves. New 11, found already 10, sideways 56, back 71 Level 12: 11 positions, 45 moves. New 7, found already 0, sideways 16, back 22 Level 13: 7 positions, 22 moves. New 8, found already 3, sideways 4, back 7 Level 14: 8 positions, 25 moves. New 4, found already 2, sideways 8, back 11 Level 15: 4 positions, 19 moves. New 3, found already 4, sideways 6, back 6 Level 16: 3 positions, 14 moves. New 3, found already 2, sideways 2, back 7 Level 17: 3 positions, 14 moves. New 5, found already 0, sideways 4, back 5 Level 18: 5 positions, 29 moves. New 7, found already 9, sideways 8, back 5 Level 19: 7 positions, 50 moves. New 8, found already 12, sideways 14, back 16 Level 20: 8 positions, 69 moves. New 20, found already 9, sideways 20, back 20 Level 21: 20 positions, 169 moves. New 15, found already 26, sideways 99, back 29 Level 22: 15 positions, 90 moves. New 8, found already 4, sideways 40, back 38 Level 23: 8 positions, 26 moves. New 4, found already 2, sideways 8, back 12 Level 24: 4 positions, 18 moves. New 4, found already 0, sideways 8, back 6 Level 25: 4 positions, 36 moves. New 13, found already 11, sideways 8, back 4 Level 26: 13 positions, 164 moves. New 40, found already 4, sideways 97, back 23 Level 27: 40 positions, 385 moves. New 48, found already 48, sideways 245, back 44 Level 28: 48 positions, 316 moves. New 22, found already 33, sideways 165, back 96 Level 29: 22 positions, 124 moves. New 11, found already 16, sideways 42, back 55 Level 30: 11 positions, 46 moves. New 5, found already 2, sideways 12, back 27 Level 31: 5 positions, 25 moves. New 5, found already 5, sideways 8, back 7 Level 32: 5 positions, 32 moves. New 2, found already 3, sideways 16, back 11 Level 33: 2 positions, 11 moves. New 5, found already 1, sideways 0, back 5 Level 34: 5 positions, 47 moves. New 14, found already 8, sideways 19, back 6 Level 35: 14 positions, 107 moves. New 22, found already 15, sideways 48, back 22 Level 36: 22 positions, 187 moves. New 42, found already 43, sideways 65, back 37 Level 37: 42 positions, 342 moves. New 85, found already 67, sideways 104, back 86 Level 38: 85 positions, 631 moves. New 100, found already 121, sideways 258, back 152 Level 39: 100 positions, 941 moves. New 104, found already 230, sideways 385, back 222 Level 40: 104 positions, 963 moves. New 67, found already 137, sideways 426, back 333 Level 41: 67 positions, 422 moves. New 17, found already 34, sideways 174, back 197 Level 42: 17 positions, 84 moves. New 7, found already 9, sideways 16, back 52 Level 43: 7 positions, 34 moves. New 3, found already 3, sideways 12, back 16 Level 44: 3 positions, 12 moves. New 4, found already 0, sideways 2, back 6 Level 45: 4 positions, 23 moves. New 11, found already 2, sideways 6, back 4 Level 46: 11 positions, 88 moves. New 26, found already 23, sideways 26, back 13 Level 47: 26 positions, 225 moves. New 32, found already 68, sideways 76, back 49 Level 48: 32 positions, 311 moves. New 46, found already 69, sideways 96, back 100 Level 49: 46 positions, 454 moves. New 66, found already 115, sideways 158, back 115 Level 50: 66 positions, 625 moves. New 58, found already 132, sideways 254, back 181 Level 51: 58 positions, 500 moves. New 45, found already 105, sideways 160, back 190 Level 52: 45 positions, 395 moves. New 30, found already 71, sideways 142, back 152 Level 53: 30 positions, 309 moves. New 37, found already 57, sideways 112, back 103 Level 54: 37 positions, 396 moves. New 79, found already 77, sideways 146, back 94 Level 55: 79 positions, 968 moves. New 85, found already 157, sideways 582, back 144 Level 56: 85 positions, 1,244 moves. New 111, found already 344, sideways 549, back 240 Level 57: 111 positions, 2,000 moves. New 162, found already 373, sideways 1,018, back 447 Level 58: 162 positions, 2,809 moves. New 184, found already 648, sideways 1,446, back 531 Level 59: 184 positions, 2,718 moves. New 129, found already 542, sideways 1,237, back 810 Level 60: 129 positions, 1,954 moves. New 45, found already 331, sideways 938, back 640 Level 61: 45 positions, 654 moves. New 24, found already 21, sideways 223, back 386 Level 62: 24 positions, 193 moves. New 49, found already 31, sideways 69, back 44 Level 63: 49 positions, 528 moves. New 64, found already 98, sideways 292, back 74 Level 64: 64 positions, 497 moves. New 43, found already 51, sideways 242, back 161 Level 65: 43 positions, 296 moves. New 35, found already 53, sideways 114, back 94 Level 66: 35 positions, 230 moves. New 29, found already 22, sideways 100, back 79 Level 67: 29 positions, 207 moves. New 42, found already 38, sideways 76, back 51 Level 68: 42 positions, 333 moves. New 53, found already 53, sideways 149, back 78 Level 69: 53 positions, 416 moves. New 24, found already 62, sideways 231, back 99 Level 70: 24 positions, 205 moves. New 9, found already 13, sideways 99, back 84 Level 71: 9 positions, 47 moves. New 5, found already 0, sideways 20, back 22 Level 72: 5 positions, 19 moves. New 6, found already 0, sideways 8, back 5 Level 73: 6 positions, 64 moves. New 15, found already 10, sideways 33, back 6 Level 74: 15 positions, 112 moves. New 37, found already 13, sideways 38, back 24 Level 75: 37 positions, 316 moves. New 44, found already 74, sideways 147, back 51 Level 76: 44 positions, 406 moves. New 54, found already 70, sideways 168, back 114 Level 77: 54 positions, 550 moves. New 47, found already 96, sideways 282, back 125 Level 78: 47 positions, 526 moves. New 43, found already 114, sideways 221, back 148 Level 79: 43 positions, 554 moves. New 19, found already 45, sideways 327, back 163 Level 80: 19 positions, 155 moves. New 6, found already 15, sideways 69, back 65 Level 81: 6 positions, 37 moves. New 4, found already 3, sideways 12, back 18 Level 82: 4 positions, 16 moves. New 3, found already 2, sideways 4, back 7 Level 83: 3 positions, 13 moves. New 1, found already 1, sideways 6, back 5 Level 84: 1 positions, 14 moves. New 10, found already 2, sideways 0, back 2 Level 85: 10 positions, 178 moves. New 37, found already 69, sideways 62, back 10 Level 86: 37 positions, 765 moves. New 86, found already 244, sideways 339, back 96 Level 87: 86 positions, 1,425 moves. New 145, found already 230, sideways 743, back 307 Level 88: 145 positions, 1,919 moves. New 244, found already 533, sideways 775, back 367 Level 89: 244 positions, 4,274 moves. New 358, found already 1,252, sideways 1,884, back 780 Level 90: 358 positions, 7,966 moves. New 332, found already 1,394, sideways 4,654, back 1,586 Level 91: 332 positions, 5,274 moves. New 382, found already 1,003, sideways 2,212, back 1,677 Level 92: 382 positions, 5,869 moves. New 359, found already 1,215, sideways 2,923, back 1,372 Level 93: 359 positions, 5,278 moves. New 339, found already 978, sideways 2,357, back 1,604 Level 94: 339 positions, 4,614 moves. New 259, found already 576, sideways 2,441, back 1,338 Level 95: 259 positions, 3,086 moves. New 231, found already 501, sideways 1,511, back 843 Level 96: 231 positions, 3,385 moves. New 359, found already 713, sideways 1,591, back 722 Level 97: 359 positions, 3,446 moves. New 428, found already 753, sideways 1,521, back 744 New Found already Sideways Back 0 10 20 30 40 50 60 70 80 90 Moves from the start (level) New position Found already for the next level Sideways, same distance Back, one move nearer the start
Figure 4. Every move the search found from each level of Pelikan Burr, by where it led. Only the blue part adds positions. Level 97 is the last searched: the position that separates the puzzle turned up while it was being worked through, and the search stopped there. Hover over a bar for its numbers.
The numbers for each level
LevelPositionsMovesBackSidewaysFound alreadyNewHeldShortest sequences
011000010111
110104101635435410
2435157816215212317778
31231,638279974275110286489
41101,149378538172613301,587
56155023318696352833,254
63534613114325472116,314
74748672216122762127,344
876845213428145592351,382
95951921220253522573,552
105231210413740312214,824
1131148715610111776,424
1211452216071152,292
1372274387296
148251182447192
15419664347288
16314722327552
17314540528840
18529589734840
197501614128382,688
208692020920586,552
2120169299926157124,696
2215903840487520,496
23826128246013,104
244186804487,560
25436481113487,056
261316423974408639,312
2740385442454848133129,024
2848316961653322143282,240
292212455421611139310,464
30114627122587308,448
31525785561122,976
325321116324950,400
3321150154860,480
3454761981454241,920
351410722481522761.0 × 106
3622187376543421172.9 × 106
37423428610467851959.6 × 106
38856311522581211002872.3 × 107
391009412223852301043796.0 × 107
40104963333426137673881.6 × 108
416742219717434173262.5 × 108
4217845216972401.5 × 108
437341612331269.8 × 107
443126204736.1 × 107
4542346211721.1 × 106
46118813262326873.5 × 106
4726225497668321181.5 × 107
48323111009669461625.4 × 107
4946454115158115662141.6 × 108
5066625181254132582534.5 × 108
5158500190160105452801.2 × 109
524539515214271302512.5 × 109
533030910311257372243.0 × 109
54373969414677792321.2 × 109
5579968144582157852803.7 × 109
56851,2442405493441113774.0 × 109
571112,0004471,0183731624711.2 × 1010
581622,8095311,4466481845734.0 × 1010
591842,7188101,2375421296081.6 × 1011
601291,954640938331455763.6 × 1011
614565438622321244355.1 × 1011
6224193446931492692.6 × 1011
63495287429298642465.5 × 1011
646449716124251432611.3 × 1012
65432969411453352772.1 × 1012
66352307910022292431.7 × 1012
6729207517638422381.5 × 1012
68423337814953532301.4 × 1012
69534169923162242342.6 × 1012
702420584991392131.5 × 1012
719472220051541.1 × 1012
7251958061145.5 × 1011
7366463310151033.8 × 1011
7415112243813371311.5 × 1012
75373165114774441744.5 × 1012
764440611416870542261.2 × 1013
775455012528296472542.7 × 1013
7847526148221114432615.5 × 1013
794355416332745192301.3 × 1014
801915565691561951.5 × 1014
816371812341411.8 × 1013
8241674231048.8 × 1011
833135611911.1 × 1012
8411420210996.3 × 1011
8510178106269371326.3 × 1012
863776596339244862185.2 × 1013
87861,4253077432301453632.7 × 1014
881451,9193677755332446016.0 × 1014
892444,2747801,8841,2523589152.2 × 1015
903587,9661,5864,6541,3943321,1737.1 × 1015
913325,2741,6772,2121,0033821,3922.2 × 1016
923825,8691,3722,9231,2153591,4834.9 × 1016
933595,2781,6042,3579783391,5241.3 × 1017
943394,6141,3382,4415762591,4123.6 × 1017
952593,0868431,5115012311,3177.3 × 1017
962313,3857221,5917133591,2431.1 × 1018
973593,4467441,5217534281,3472.1 × 1018

Pelikan Burr's eleven other assemblies never come apart. Their searches run until a level comes out empty, having found every position the pieces can reach, and they show the same pattern. On the other puzzles most moves also lead to positions already found.

PuzzleAssemblies searchedPositions foundMoves foundBackSidewaysFound alreadyNew
Pelikan Burrthe assembly that comes apart6,74281,00725%47%19%8%
Pelikan Burrthe 11 that do not7,46076,05527%46%17%10%
Dracula's Dental Disasterall 84 assemblies1,3087,42618%53%13%16%
Cube in Cageall 96 assemblies8562,59647%4%20%29%
Prisgonits one assembly173938%15%5%41%

The table counts the search of the whole assembly, up to its first separation or until nothing new is left. The searches of the parts (section 7) are not included. In the short take-aparts of Prisgon and Cube in Cage the levels hold only a handful of positions, so a larger share of the moves leads somewhere new. Even there, most do not.

5. How many ways there are

The search drops the moves that lead to a position found already, so it never learns how many shortest ways lead anywhere. The copy of the search used for this page counted them. Each position carried a number: 1 for the start, and for every other position the sum of the numbers of all the positions one level nearer the start that have a move to it. Figure 5 sets these counts against the number of positions in each level.

1 103 106 109 1012 1015 1018 Count (log scale) Shortest sequences Positions level 84: one position Level 0: 1 positions, 1 shortest move sequences Level 1: 10 positions, 10 shortest move sequences Level 2: 43 positions, 78 shortest move sequences Level 3: 123 positions, 489 shortest move sequences Level 4: 110 positions, 1,587 shortest move sequences Level 5: 61 positions, 3,254 shortest move sequences Level 6: 35 positions, 6,314 shortest move sequences Level 7: 47 positions, 7,344 shortest move sequences Level 8: 76 positions, 1,382 shortest move sequences Level 9: 59 positions, 3,552 shortest move sequences Level 10: 52 positions, 4,824 shortest move sequences Level 11: 31 positions, 6,424 shortest move sequences Level 12: 11 positions, 2,292 shortest move sequences Level 13: 7 positions, 96 shortest move sequences Level 14: 8 positions, 192 shortest move sequences Level 15: 4 positions, 288 shortest move sequences Level 16: 3 positions, 552 shortest move sequences Level 17: 3 positions, 840 shortest move sequences Level 18: 5 positions, 840 shortest move sequences Level 19: 7 positions, 2,688 shortest move sequences Level 20: 8 positions, 6,552 shortest move sequences Level 21: 20 positions, 24,696 shortest move sequences Level 22: 15 positions, 20,496 shortest move sequences Level 23: 8 positions, 13,104 shortest move sequences Level 24: 4 positions, 7,560 shortest move sequences Level 25: 4 positions, 7,056 shortest move sequences Level 26: 13 positions, 39,312 shortest move sequences Level 27: 40 positions, 129,024 shortest move sequences Level 28: 48 positions, 282,240 shortest move sequences Level 29: 22 positions, 310,464 shortest move sequences Level 30: 11 positions, 308,448 shortest move sequences Level 31: 5 positions, 122,976 shortest move sequences Level 32: 5 positions, 50,400 shortest move sequences Level 33: 2 positions, 60,480 shortest move sequences Level 34: 5 positions, 241,920 shortest move sequences Level 35: 14 positions, 1.0e6 shortest move sequences Level 36: 22 positions, 2.9e6 shortest move sequences Level 37: 42 positions, 9.6e6 shortest move sequences Level 38: 85 positions, 2.3e7 shortest move sequences Level 39: 100 positions, 6.0e7 shortest move sequences Level 40: 104 positions, 1.6e8 shortest move sequences Level 41: 67 positions, 2.5e8 shortest move sequences Level 42: 17 positions, 1.5e8 shortest move sequences Level 43: 7 positions, 9.8e7 shortest move sequences Level 44: 3 positions, 6.1e7 shortest move sequences Level 45: 4 positions, 1.1e6 shortest move sequences Level 46: 11 positions, 3.5e6 shortest move sequences Level 47: 26 positions, 1.5e7 shortest move sequences Level 48: 32 positions, 5.4e7 shortest move sequences Level 49: 46 positions, 1.6e8 shortest move sequences Level 50: 66 positions, 4.5e8 shortest move sequences Level 51: 58 positions, 1.2e9 shortest move sequences Level 52: 45 positions, 2.5e9 shortest move sequences Level 53: 30 positions, 3.0e9 shortest move sequences Level 54: 37 positions, 1.2e9 shortest move sequences Level 55: 79 positions, 3.7e9 shortest move sequences Level 56: 85 positions, 4.0e9 shortest move sequences Level 57: 111 positions, 1.2e10 shortest move sequences Level 58: 162 positions, 4.0e10 shortest move sequences Level 59: 184 positions, 1.6e11 shortest move sequences Level 60: 129 positions, 3.6e11 shortest move sequences Level 61: 45 positions, 5.1e11 shortest move sequences Level 62: 24 positions, 2.6e11 shortest move sequences Level 63: 49 positions, 5.5e11 shortest move sequences Level 64: 64 positions, 1.3e12 shortest move sequences Level 65: 43 positions, 2.1e12 shortest move sequences Level 66: 35 positions, 1.7e12 shortest move sequences Level 67: 29 positions, 1.5e12 shortest move sequences Level 68: 42 positions, 1.4e12 shortest move sequences Level 69: 53 positions, 2.6e12 shortest move sequences Level 70: 24 positions, 1.5e12 shortest move sequences Level 71: 9 positions, 1.1e12 shortest move sequences Level 72: 5 positions, 5.5e11 shortest move sequences Level 73: 6 positions, 3.8e11 shortest move sequences Level 74: 15 positions, 1.5e12 shortest move sequences Level 75: 37 positions, 4.5e12 shortest move sequences Level 76: 44 positions, 1.2e13 shortest move sequences Level 77: 54 positions, 2.7e13 shortest move sequences Level 78: 47 positions, 5.5e13 shortest move sequences Level 79: 43 positions, 1.3e14 shortest move sequences Level 80: 19 positions, 1.5e14 shortest move sequences Level 81: 6 positions, 1.8e13 shortest move sequences Level 82: 4 positions, 8.8e11 shortest move sequences Level 83: 3 positions, 1.1e12 shortest move sequences Level 84: 1 positions, 6.3e11 shortest move sequences Level 85: 10 positions, 6.3e12 shortest move sequences Level 86: 37 positions, 5.2e13 shortest move sequences Level 87: 86 positions, 2.7e14 shortest move sequences Level 88: 145 positions, 6.0e14 shortest move sequences Level 89: 244 positions, 2.2e15 shortest move sequences Level 90: 358 positions, 7.1e15 shortest move sequences Level 91: 332 positions, 2.2e16 shortest move sequences Level 92: 382 positions, 4.9e16 shortest move sequences Level 93: 359 positions, 1.3e17 shortest move sequences Level 94: 339 positions, 3.6e17 shortest move sequences Level 95: 259 positions, 7.3e17 shortest move sequences Level 96: 231 positions, 1.1e18 shortest move sequences Level 97: 359 positions, 2.1e18 shortest move sequences 0 10 20 30 40 50 60 70 80 90 Moves from the start (level) Positions in the level Shortest move sequences into the level
Figure 5. Pelikan Burr, on a log scale. The positions in a level stay in the hundreds, while the number of different shortest move sequences into the level grows by about 1.5 times for every move. At level 84 a single position is left, and every shortest way passes through it.

By level 97 the 359 positions of the level are reached by 2.1 × 1018 different shortest move sequences. The separating position is reached by at least 5.7 × 1014 of them. That is a lower bound, because the search stopped as soon as it was found and did not see the other positions of level 97 that might also lead to it. A tree, even one that only kept shortest ways, would have to hold every one of those sequences. The graph holds 6,742 positions.

The single position at level 84 is a bottleneck: the puzzle has to pass through exactly that arrangement, 84 moves in, on any shortest way out. There are 6.3 × 1011 shortest ways to reach it, and the search keeps one.

6. What the links keep in memory

Each position counts the references to it. A front holds a reference to each of its positions, and each position holds a reference to the one its link points to. When the old front is let go, a position in it survives only if some newer position's link leads back through it. Dead ends, positions from which nothing new was found, are freed. So are the branches behind them.

Figure 6 compares the positions the search has found so far with the positions it holds at the same moment. Pelikan Burr's search found 6,742 positions. At most 1,524 were in memory at once, at level 93: the three fronts, plus 444 older positions that are kept only because a link runs through them. The rest had been freed along the way.

0 2,500 5,000 7,500 10,000 Positions Found so far Held at once Links only Level 0: 11 found so far; 11 held, 11 in the three fronts and 0 only as links back Level 1: 54 found so far; 54 held, 54 in the three fronts and 0 only as links back Level 2: 177 found so far; 177 held, 176 in the three fronts and 1 only as links back Level 3: 287 found so far; 286 held, 276 in the three fronts and 10 only as links back Level 4: 348 found so far; 330 held, 294 in the three fronts and 36 only as links back Level 5: 383 found so far; 283 held, 206 in the three fronts and 77 only as links back Level 6: 430 found so far; 211 held, 143 in the three fronts and 68 only as links back Level 7: 506 found so far; 212 held, 158 in the three fronts and 54 only as links back Level 8: 565 found so far; 235 held, 182 in the three fronts and 53 only as links back Level 9: 617 found so far; 257 held, 187 in the three fronts and 70 only as links back Level 10: 648 found so far; 221 held, 142 in the three fronts and 79 only as links back Level 11: 659 found so far; 177 held, 94 in the three fronts and 83 only as links back Level 12: 666 found so far; 115 held, 49 in the three fronts and 66 only as links back Level 13: 674 found so far; 72 held, 26 in the three fronts and 46 only as links back Level 14: 678 found so far; 47 held, 19 in the three fronts and 28 only as links back Level 15: 681 found so far; 47 held, 15 in the three fronts and 32 only as links back Level 16: 684 found so far; 27 held, 10 in the three fronts and 17 only as links back Level 17: 689 found so far; 28 held, 11 in the three fronts and 17 only as links back Level 18: 696 found so far; 34 held, 15 in the three fronts and 19 only as links back Level 19: 704 found so far; 38 held, 20 in the three fronts and 18 only as links back Level 20: 724 found so far; 58 held, 35 in the three fronts and 23 only as links back Level 21: 739 found so far; 71 held, 43 in the three fronts and 28 only as links back Level 22: 747 found so far; 75 held, 43 in the three fronts and 32 only as links back Level 23: 751 found so far; 60 held, 27 in the three fronts and 33 only as links back Level 24: 755 found so far; 48 held, 16 in the three fronts and 32 only as links back Level 25: 768 found so far; 48 held, 21 in the three fronts and 27 only as links back Level 26: 808 found so far; 86 held, 57 in the three fronts and 29 only as links back Level 27: 856 found so far; 133 held, 101 in the three fronts and 32 only as links back Level 28: 878 found so far; 143 held, 110 in the three fronts and 33 only as links back Level 29: 889 found so far; 139 held, 81 in the three fronts and 58 only as links back Level 30: 894 found so far; 87 held, 38 in the three fronts and 49 only as links back Level 31: 899 found so far; 61 held, 21 in the three fronts and 40 only as links back Level 32: 901 found so far; 49 held, 12 in the three fronts and 37 only as links back Level 33: 906 found so far; 48 held, 12 in the three fronts and 36 only as links back Level 34: 920 found so far; 54 held, 21 in the three fronts and 33 only as links back Level 35: 942 found so far; 76 held, 41 in the three fronts and 35 only as links back Level 36: 984 found so far; 117 held, 78 in the three fronts and 39 only as links back Level 37: 1,069 found so far; 195 held, 149 in the three fronts and 46 only as links back Level 38: 1,169 found so far; 287 held, 227 in the three fronts and 60 only as links back Level 39: 1,273 found so far; 379 held, 289 in the three fronts and 90 only as links back Level 40: 1,340 found so far; 388 held, 271 in the three fronts and 117 only as links back Level 41: 1,357 found so far; 326 held, 188 in the three fronts and 138 only as links back Level 42: 1,364 found so far; 240 held, 91 in the three fronts and 149 only as links back Level 43: 1,367 found so far; 126 held, 27 in the three fronts and 99 only as links back Level 44: 1,371 found so far; 73 held, 14 in the three fronts and 59 only as links back Level 45: 1,382 found so far; 72 held, 18 in the three fronts and 54 only as links back Level 46: 1,408 found so far; 87 held, 41 in the three fronts and 46 only as links back Level 47: 1,440 found so far; 118 held, 69 in the three fronts and 49 only as links back Level 48: 1,486 found so far; 162 held, 104 in the three fronts and 58 only as links back Level 49: 1,552 found so far; 214 held, 144 in the three fronts and 70 only as links back Level 50: 1,610 found so far; 253 held, 170 in the three fronts and 83 only as links back Level 51: 1,655 found so far; 280 held, 169 in the three fronts and 111 only as links back Level 52: 1,685 found so far; 251 held, 133 in the three fronts and 118 only as links back Level 53: 1,722 found so far; 224 held, 112 in the three fronts and 112 only as links back Level 54: 1,801 found so far; 232 held, 146 in the three fronts and 86 only as links back Level 55: 1,886 found so far; 280 held, 201 in the three fronts and 79 only as links back Level 56: 1,997 found so far; 377 held, 275 in the three fronts and 102 only as links back Level 57: 2,159 found so far; 471 held, 358 in the three fronts and 113 only as links back Level 58: 2,343 found so far; 573 held, 457 in the three fronts and 116 only as links back Level 59: 2,472 found so far; 608 held, 475 in the three fronts and 133 only as links back Level 60: 2,517 found so far; 576 held, 358 in the three fronts and 218 only as links back Level 61: 2,541 found so far; 435 held, 198 in the three fronts and 237 only as links back Level 62: 2,590 found so far; 269 held, 118 in the three fronts and 151 only as links back Level 63: 2,654 found so far; 246 held, 137 in the three fronts and 109 only as links back Level 64: 2,697 found so far; 261 held, 156 in the three fronts and 105 only as links back Level 65: 2,732 found so far; 277 held, 142 in the three fronts and 135 only as links back Level 66: 2,761 found so far; 243 held, 107 in the three fronts and 136 only as links back Level 67: 2,803 found so far; 238 held, 106 in the three fronts and 132 only as links back Level 68: 2,856 found so far; 230 held, 124 in the three fronts and 106 only as links back Level 69: 2,880 found so far; 234 held, 119 in the three fronts and 115 only as links back Level 70: 2,889 found so far; 213 held, 86 in the three fronts and 127 only as links back Level 71: 2,894 found so far; 154 held, 38 in the three fronts and 116 only as links back Level 72: 2,900 found so far; 114 held, 20 in the three fronts and 94 only as links back Level 73: 2,915 found so far; 103 held, 26 in the three fronts and 77 only as links back Level 74: 2,952 found so far; 131 held, 58 in the three fronts and 73 only as links back Level 75: 2,996 found so far; 174 held, 96 in the three fronts and 78 only as links back Level 76: 3,050 found so far; 226 held, 135 in the three fronts and 91 only as links back Level 77: 3,097 found so far; 254 held, 145 in the three fronts and 109 only as links back Level 78: 3,140 found so far; 261 held, 144 in the three fronts and 117 only as links back Level 79: 3,159 found so far; 230 held, 109 in the three fronts and 121 only as links back Level 80: 3,165 found so far; 195 held, 68 in the three fronts and 127 only as links back Level 81: 3,169 found so far; 141 held, 29 in the three fronts and 112 only as links back Level 82: 3,172 found so far; 104 held, 13 in the three fronts and 91 only as links back Level 83: 3,173 found so far; 91 held, 8 in the three fronts and 83 only as links back Level 84: 3,183 found so far; 99 held, 14 in the three fronts and 85 only as links back Level 85: 3,220 found so far; 132 held, 48 in the three fronts and 84 only as links back Level 86: 3,306 found so far; 218 held, 133 in the three fronts and 85 only as links back Level 87: 3,451 found so far; 363 held, 268 in the three fronts and 95 only as links back Level 88: 3,695 found so far; 601 held, 475 in the three fronts and 126 only as links back Level 89: 4,053 found so far; 915 held, 747 in the three fronts and 168 only as links back Level 90: 4,385 found so far; 1,173 held, 934 in the three fronts and 239 only as links back Level 91: 4,767 found so far; 1,392 held, 1,072 in the three fronts and 320 only as links back Level 92: 5,126 found so far; 1,483 held, 1,073 in the three fronts and 410 only as links back Level 93: 5,465 found so far; 1,524 held, 1,080 in the three fronts and 444 only as links back Level 94: 5,724 found so far; 1,412 held, 957 in the three fronts and 455 only as links back Level 95: 5,955 found so far; 1,317 held, 829 in the three fronts and 488 only as links back Level 96: 6,314 found so far; 1,243 held, 849 in the three fronts and 394 only as links back Level 97: 6,742 found so far; 1,347 held, 1,017 in the three fronts and 330 only as links back 0 10 20 30 40 50 60 70 80 90 Moves from the start (level) Positions found so far Positions held in memory Held only as links back
Figure 6. Pelikan Burr: the positions found so far, the positions held in memory at the end of each level, and how many of those are held only as links back from the fronts. Hover for the numbers.

These numbers are small: the whole solve of Pelikan Burr, assemblies and take-apart, takes about 0.03 seconds. What matters is that memory follows the width of the fronts, not everything the search has seen. The same code takes apart puzzles whose levels are far wider, and it runs once for every assembly the Solver finds, sometimes thousands of times in one solve.

7. After the first separation

When a position separates the puzzle, the search follows the links from it back to the start and writes down every position on the way. These are the moves the Solver shows for this part of the take-apart.

The pieces have now fallen into two parts. A part of one piece is done, and so is a part whose pieces may stay together as a group. Any other part becomes a new search of the same kind. It starts from the places its pieces had just before the separation and has three fronts of its own. That continues until every piece is free, and the results form the separation tree that the Solver animates. The search of a part runs inside the search of the whole, so the whole one's fronts stay in memory until its parts are done.

The level the Solver reports for Pelikan Burr is 99.3.4.2. Each number counts the moves until a single piece comes free. The search above found the first separation after 98 moves, but that separation splits the puzzle into two groups of pieces, not a single piece. The part that came out needs one more move to free a piece, so the first number is 99. The puzzle file's own note agrees: "It takes 98 moves to get the first piece out of the box."

Fast (Crowell), the Solver's other take-apart, keeps the same three fronts and links. The differences are that it takes at most 100 new positions from each position and finds turns with a generator of its own. Because of that limit it can miss a shorter way.

8. The sliding and Panex solvers

The Sliding Puzzle Solver and the Panex Solver also search breadth first for the fewest moves, and they also drop every move that leads to an arrangement they already have. The bookkeeping is different, because their levels can hold millions or billions of arrangements, where a take-apart's usually hold hundreds or thousands.

Puzzle Solving: Solving Faster with a Defined Solution covers all of this in detail.

Take-apart searchSliding and Panex solvers
A positionEvery piece's place and turn, the move, the distance and one link backOne 64- or 128-bit key; no link
A levelA hash table of positionsA sorted list of keys, in memory or on disk
Known positions found inThe level before, this level and the nextThe new level while it is merged, then the two newest levels; with nested slides, older levels for one-way moves
Moves to known positionsDroppedDropped
The pathFollowed back along the linksRebuilt by looking moves up in the level below
What stays behind the frontsOnly positions on a chain of linksOlder levels, for the rebuild (some thinned when the disk fills)
From both endsNo: the separating position is not known in advanceYes, when the goal is one arrangement

The Sliding Puzzle Solver's older search, still used for trays too big for the widest key, works like the take-apart. It keeps a table that gives every arrangement the arrangement it came from, and follows that table back to rebuild the path.

9. Where it comes from

The take-apart search was ported from BurrTools by Andreas Röver: its three fronts, the counted links and the rule that two positions are equal up to a shift of the whole puzzle. The moves are found with Bill Cutler's method from his booklet Computer Analysis of All 6 Piece Burrs. It starts from how far each piece can move while every other piece stands still. ShapeLogic gives the same answers as the original on the comparison corpus.

Sources

← Back to Research