The puzzles in the app Sort Puzzle aren’t prepared in advance. The app makes them on the spot every time you play. Even so, it shows every puzzle only after confirming that it can be solved. Here is how it makes them.

The Steps

  1. Choose the colors: Pick as many colors out of the 10 as the difficulty calls for (4 colors for ★1).
  2. Mix and deal: Gather 4 of each chosen color, mix them, and pack 4 into each tube that holds colors. Line up the spare tubes on the right.
  3. Throw out nearly sorted tubes: If any tube has a run of three or more of one color, don’t use that deal. A tube that is almost sorted from the start is boring.
  4. Check that it can be solved: Use the computer’s solver to search for steps to a sorted position. If it can’t find any, don’t use that deal.
  5. Check the trap condition: For ★3 and up, check whether the puzzle has a trap, where you get stuck if you keep picking the move that looks good right now, and deal again until it meets the difficulty’s condition (see Puzzles with Traps).
123456
An example of a ★1 puzzle made this way

Each time it makes a puzzle, the app repeats these steps until it finds a deal that meets the conditions. Even for ★5, making one puzzle takes only tens of milliseconds at most.

How Many Randomly Dealt Puzzles Can Be Solved?

How many deals does step 4 throw out? I dealt the same way the app does, and for “deals with no tube holding a run of three or more of one color” (fair deals), I checked every one to see whether it could be solved.

DifficultyFair dealsSolvable deals
★1 (4 colors, 2 spare)416416
★2 (6 colors, 2 spare)431431
★3 (8 colors, 2 spare)453453
★4 (10 colors, 2 spare)460460
★5 (9 colors, 1 spare)453929

In ★1 to ★4, which have two spare tubes, every fair deal I counted could be solved. But in ★5, with one spare tube, only 29 of 4539 (0.64%) could be solved. The rest are deals that can’t be sorted however you move.

With One Spare Tube, Solvability Suddenly Drops

I also counted how the share of solvable deals changes with the number of colors when there is one spare tube.

Number of colors (1 spare)Share solved
3 colors72.7%
4 colors44.9%
5 colors26.3%
6 colors14.0%
7 colors6.0%
8 colors2.3%
9 colors0.64%

With each added color, the share that can be solved drops by about half, and with more colors it drops even faster. With one spare tube, your first move has to go into the spare tube, and there are few paths to choose from after that, which seems to be the reason (see How to Solve ★5 (One Spare Tube)).

How ★5 Is Made

In ★5, deals that can be solved are rare, so the app deals again up to 400 times. If it still can’t find one, it switches to a different method.

  • Break up a sorted puzzle: Start from a puzzle where the colors are sorted, and break it up at random with moves in reverse. If you replay the reversed moves backward, it always sorts, so it’s guaranteed to be solvable.

When I made 500 ★5 puzzles the same way the app does, 18 of them were these “broken-up puzzles.” A broken-up puzzle may not have tubes packed with 4 each.

The Same Seed Gives the Same Puzzle

The random numbers used to make puzzles come from a method (SplitMix64) that gives the same sequence every time once you fix a number called the “seed.” The same seed makes the same puzzle. The board in Play in Your Browser on this site also makes puzzles by the same steps as the app.

How the solver that checks for solvability works is covered in Solving It by Computer.