C++ Puzzle Solver: Mastering Scramble Squares in Record Time

Clever C++ program cracks puzzles: how to solve scramble squares quickly

The makers of classic jigsaw puzzles are constantly trying to outbid each other with larger puzzle sizes. From 1000 pieces to 5000 and even 10,000, the difficulty increases with the number of pieces. However, it may come as a surprise that a puzzle with only nine pieces can provide a challenge for many hours.

One example of these unique puzzles is the Scramble Squares brand, where the nine pieces are square and printed with halves of four different motifs. The goal is to fit these pieces together in such a way that the halves connect to form the complete motif. Another variant, like the One Tough Puzzle, includes shapes sticking out on some edges (positives) that fit into identically shaped recesses (negatives) on other edges.

The large number of possible combinations in these puzzles makes them surprisingly difficult. For example, there are 9 ways to place the first piece in the 3×3 grid, 8 ways for the second piece, 7 for the third, and so on. This results in a total of 362,880 arrangement possibilities (9!). Each piece can also be oriented in one of four ways, except for the middle piece which determines the overall orientation. This leaves 48 possible orientations.

Multiplying the number of arrangements by the number of orientations gives us a total of 23,781,703,680 possible constellations. That’s over 23 billion! However, in a well-made puzzle, there is only one solution underneath, as shown in the picture at the beginning of this article.

If you feel the sudden urge to puzzle, you can even download the PDF version of these puzzles. With a digital subscription for IT and technology, you can access exclusive tests, guides, and background information from various magazines. One subscription covers all magazines, including c’t, iX, MIT Technology Review, Mac & i, and Make. You can also read c’t photography directly in your browser.

There’s no risk in trying it out, as the first month is free, and then it’s only €9.95 per month. If you are already a magazine subscriber, you can enjoy an even cheaper price. Start your free month now and continue reading right away. If you’re already subscribed to heise+, simply register and read the article immediately.

Leave a Reply