Are computers good at solving puzzles?

A coaster puzzle and a solution algorithm for puzzles of this type

In order to explore the limits of VBScript, I used this language for problem solving. I also want to say that the puzzle annoyed me very much because I couldn't come up with a solution strategy that works without a computer. This page should not mislead anyone to acquire such puzzles. But if someone has made the mistake, the following script should be able to help him to restore the initial state or to implement further unexpected solutions. It runs on any Windows computer with XP or newer, but must of course be preconfigured according to the specific puzzle - iKanten = number of maximum possible cubes on each edge of the square base and all puzzle pieces are analogous for example script to encode the algorithm. The results are output in a file in which the individual solutions appear at least 4 times. It is clear to me that for this reason alone the implemented algorithm is not optimal. My goal was to find all possible solutions without a lot of headache, which is probably also achievable if the first inserted part is not additionally inserted rotated. I leave the interpretation of the result squares to you - a little puzzle should remain ;-)

The script could of course also be misused to analyze other - even more difficult to solve - puzzles. But I think that simpler ones are preferable from a human point of view.

WARNING: Use the script at your own risk! Try to understand the script before configuring and running it. The running time of the script is about 20 times longer if two more puzzle pieces are used - 8 pieces about 3 s to 60 min; 10 parts about 1 minute - 20 hours; 12 about 20 min - 20 days; ...
Another problem is the lack of cubes, as this leads to a sharp increase in the runtime and the possible solutions, which means that the solution file can easily come up against hardware and software limits. In the pathological case of a 12-piece puzzle that has no dice on the 12 rails, the result is (2 to the power of 12) * 12! (! stands for factor) solution fields that would have to be saved in a file. Presumably there is currently no file system that can accommodate this file. After all, the same puzzle pieces and 'rotationally symmetrical' puzzle pieces also contribute to large solution files and long runtimes.

A little to understand the script:

Each piece of the puzzle is represented as a two-dimensional field of length 2 and depth iKanten + 1. For each of the 2 * (iKanten-1) steps of the puzzle completion there is a result field. Similarly, there is a three-dimensional field of the remaining parts for each step. This enables a memory-saving recursive solution. As a rule, the parameters of the subroutines are of no importance, as global variables are mainly used. However, they were helpful in programming and were therefore left in place.

Calling the script from the command line:

cscript coasters.vbs

Content of the solution file 'Loesung_Untersetzer.txt' for the script example:



Script example: