Solving the Snake Cube Puzzle in Haskell

This page last updated: August 22, 2012

The Snake Cube Puzzle

This page is under construction!


This page provides materials to accompany the paper "Solving the Snake Cube Puzzle in Haskell" (revised version finalized on August 22, 2012). This paper has been submitted to be considered for publication in the Journal of Functional Programming. Please consider it a draft document, not intended for distribution at this time.

The following additional items are currently available:

  • A solution for the standard 3x3x3 snake cube puzzle in pdf format.

  • A solution for the 4x4x4 "king" snake cube puzzle in pdf format. In this particular solution, the two ends of the snake end up in corners of the 4x4x4 cube, so we refer to it as a corner-to-corner solution. There is also a reversed version of the same solution.

  • An additional three solutions for the 4x4x4 king, all of which start and end one position away from the corner of the 4x4x4. The first two are very similar, differing in only 4 steps (35, 36, 38, and 39). The third agrees with the first two for the first 13 steps and then does its own thing (although, interestingly, all three solutions end up putting the same pieces in place in Step 37). (For completeness, there are also diagrams showing these three solutions in reverse. It is easier to see the subtle difference between the first two of these three solutions here: compare Steps 6-9 on Pages 1 and 5 and note that all of the other steps are the same in those two solutions.)

  • A diagram of the search tree for the standard snake cube, constructed using a modified version of the solver and the GraphViz toolset.

  • The Haskell source for solving snake cube puzzles and for constructing a sequence of diagrams to illustrate a solution to a snake cube puzzle.

  • Some additional solutions:

    • Another version of the the standard snake cube solution that includes headers.

    • An alternative presentation of the solution for the standard snake that assembles the pieces in the reverse order. This solution is actually a little harder to use in practice: it gets a little tricky around Steps 12 and 13. In terms of the paper, this is the solution for (advance (advance (reversePuzzle standard))).

    • An experiment showing the standard snake cube solution with three distinct views at each step.

    • A similar three-views version of the corner-to-corner solution for the king cube.

    • Solutions to the Ornery Orange version (also available in reverse order), and the Mean Green version (again also available in reverse order).

    • Solutions to the designs shown in Figure 2 and Figure 3 of Allen F. Dreyer's US Patent 3,222,072. I'm not expecting to be able to test these. You'll notice also that there are 18 variations listed for the Figure 3 example, producing a monster document of solutions. I've done some pruning using symmetry to eliminate some essentially equivalent solutions, but there might be scope for further reduction. On the other hand, it's also possible that there are additional solutions that do not start/end in a corner of the full cube; I haven't tried looking for those yet.

    • Solutions for folding the standard snake, the mean green snake, and the ornery orange snake into their most compact flat forms. Useful if you are transporting a snake and need to fit it into a thin bag or briefcase, for example. (Really!)

I'll continue to update this page with additional related items of interest; if there is something in particular that you are looking for, please let me know.

Acknowledgments: The diagrams on this page were generated with the help of the Haskell programming language; Gene Ressler's Sketch tool; Till Tantau's PGF and TikZ graphic systems for TeX; the LaTeX typesetting system; some real snake cube puzzles from Creative Crafthouse; and, most importantly, the indulgence of my family.