soma


soma, a MATLAB code which computes solutions to Piet Hein's soma cube puzzle.

The soma cube puzzle consists of 7 pieces, named V, L, T, Z, R, S, and Y. Piet Hein, the puzzle's originator, and Martin Gardner, who published one of the earliest descriptions of it, label these pieces numerically, as 1 through 7. Note that pieces R and S (5 and 6) are mirror images of each other. The pieces can be assembled into a 3x3x3 cube, consisting of 27 labeled cubelets. There are 240 distinct solutions, disregarding solutions that are equivalent under reflection and rotation.

The mapping of cubelet labels to bit positions is rectangular, the lower left corner being 0, increasing by 1 in the x direction, by 3 in the y direction, and 9 in the z direction. Converting a label to base-3 notation gives the xyz coordinates of the cubelet.

bottom middle top 6 7 8 151617 242526 y 3 4 5 121314 212223 0 1 2 91011 181920 x

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

soma is available in a MATLAB version.

Related Data and codes:

soma_test

Reference:

  1. Martin Gardner,
    "The Soma Cube",
    The Second Scientific American Book of Mathematical Puzzles and Diversions,
    Simon and Schuster, 1961.

Source Code:


Last revised on 13 June 2022.