Introduction

Screen Shot of Somato

Somato solves and animates the Soma cube puzzle invented by Piet Hein. Seven pieces made out of unit cubes must be assembled into a 3×3×3 cube. The pieces of the Soma cube consist of all possible combinations of four or fewer unit cubes, excluding all regular shapes (i.e., the 1×1×1, 1×1×2, 1×1×3, 1×1×4 and 1×2×2 cuboids). This leaves just one three-block piece and six four-block pieces.

Somato is Open Source and released under the terms of the GNU General Public License.

A bit of History

Somato originally began around 2003 as a Delphi programming task in a computer science class at school. However, after I had implemented the actual puzzle solver and thus practically finished the task, my tinkering habit got the better of me.

First, I started optimizing the puzzle solver algorithm. The very first working implementation took roughly three-quarters of an hour to complete on my old Pentium III clocked at 866 MHz. The current version finishes the same task within two hundredths of a second — on the same CPU. Nonetheless it’s still basically a brute force algorithm, even though some tricks are employed to cut down the number of iterations quite a bit.

After that my attention turned to OpenGL, and I started working on the animation of the puzzle. At this point Somato had definitely ceased to be a school project, as the original task didn’t even include a user interface at all. But don’t hold your breath, the result looks pretty mundane actually. I focused more on the implementation as I intended to learn OpenGL along the way. For real 3-D development I unfortunately lack the artistic talent. Anyway, somewhere in between the endless refactoring cycles I ported the whole thing to C++ and gtkmm, and continued development on Linux from then on.

Some time later I became interested in leveraging the SIMD instructions of modern CPUs. The result of my experiments was a floating-point vector class implemented with SSE intrinsics. Such an approach of object-oriented encapsulation doesn’t optimally reap the benefits of SIMD processing. But I really love encapsulation, and the task wasn’t well suited for the SoA approach anyway. Now I only need someone to donate me a PowerPC so that I can code an implementation for AltiVec

Installation

So you want to try it out? Great! But please don’t expect too much. Somato doesn’t really have any productive value, and it’s not a game either. It’s just a small toy I personally grew attached to. You could use it for cheating with your wooden Soma cube though, if you have one. Anyway, here we go:

Binary Packages for Ubuntu 6.10

If you’re running Ubuntu 6.10 (Edgy Eft) you’re lucky, because the Debian packages were made just for you. If you’re not on AMD64 yet, I recommend to get the SSE-optimized package. Unless of course if your CPU is older than the Pentium III or Athlon XP.

These packages might also work on other Debian-based distributions, I haven’t tried. If not, or if you’re running something other than i386 or AMD64 anyway, you can build your own package. Just unpack the source tarball and run:

Voilà, there’s your binary package. Note that you don’t have to provide any options to configure, as it’s only needed to create the Makefile to be able to use the dist-deb convenience target.

Source Code

If you’re interested in seeing the source code of Somato, or if the binary packages don’t work for you, fetch the source tarball instead. Then build the binary as usual:

If configure fails due to missing dependencies, just resolve them and try again. If you’re building for i386, I recommend to run:

This makes the compiler produce code for Pentium III and compatible CPUs, which in turn enables the SSE intrinsics. The availability of the intrinsics is then automatically detected by configure. You may also pass other flags more specific to your processor if you like. The floating-point vector class in Somato will also happily take advantage of SSE2 if available. Note that -mfpmath=sse is not strictly necessary, but I would recommend it anyway. It tells the compiler to issue SSE instructions for scalar floating-point math. This is enabled by default on AMD64.

That’s about it. Enjoy!