Schlangen-Puzzle

The Schlangen-puzzle consists of a string of 27 wooden cubes (see photos). The cubes can be rotated against each other. The string can be thought of as consisting of 17 straight segments in which the cubes form a straight row. In between these straight segments, the direction of the string changes by 90 degrees. Starting from one end of the string (on the left side of the photo), the lengths of the straight sequences in number of cubes are
3-1-1-2-1-2-1-1-2-2-1-1-1-2-2-2-2
Note that this sequence is not symmetric. It is the purpose of the game to arrange the string into´a 3x3x3 cube similar to Rubick's cube (see photo below).

To solve this problem on the computer, it is actually easier to start from the other end of the string (the end in the lower center section in the photo above). Doing a few twists and turns, it becomes obvious that the last cube must sit in a corner of the final 3x3x3 cube.

Suppose now you are looking at a face of the 3x3x3 cube. Let's denote the direction from left to right by +0, from left to right by -0, front to back by +2, back to front by -2, from down to up by +1, and up to down by -1. Give a wooden cube that sits in the left lower front corner the coordinates (0,0,0), then position the first three wooden cubes to the right so that the third one occupies the cell (2,0,0). The second segment, or branch, goes to (2,2,0). All other arrangements would obviously just be rotations or mirrors of this beginning. However, one has the choice now to turn the third branch either in direction -0 so that it ends at (0,2,0), or in direction +2 so that it ends at (2,2,2). From here on, a tree of possiblities starts. At least one of the leaves hopefully fills the 3x3x3 cube.

This C++ program runs through the entire tree, checking 342 configurations. Information is printed on the screen. The depth of the current branch in the tree is shown by the number of whitespace characters preceding each line. Here is the program´s output.

You can also download the program as a C++ text file or download the compiled Program (Windows .exe application, 215 kB. Run this program in a text shell).

Here is the solution of the puzzle.

Last change: 24 March 2004