Soma Solver version 1.3

Copied from Ross Channing's homepage 2012.

Introduction

This program solves Soma cube problems. If you don't know what the Soma cube is, here's a brief description.

Using this program you can build up a Soma cube shape interactively, adding and removing cubes and viewing the shape from any angle or position. When you're done, the program will analyze the shape and see if it has a solution. If so, you can either see the complete solution, or just get a hint. If you're totally fed up trying to solve a shape, as I have been on occasion, this feature can end your torment.

Once you've solved the shape, you can save it to a file. You can also open previously saved shapes.

Through-out this help file, I've used the notation "Main | Option" to mean: select the menu option marked "Main", and from the popup menu select "Option". So for example, "File | Open" means select the File menu and choose Open.

If you haven't used this program before, you should probably read the following sections in order.

1. The Window Layout
2. Creating A Puzzle
3. Solving
4. Saving & Opening
5. Options
6. What Is The Soma Cube?
7. For The Future

The Window Layout

The main window of the program looks like this:



The window title bar contains the name of the puzzle and the program mode. The name of the puzzle ("New Puzzle" in this example) is the name which the puzzle was given when it was saved to disk. If it hasn't been saved to disk (eg. if it's a new one you've just created), the program gives it the default name "New Puzzle".

The program has two modes: edit mode (indicated by "Editing" in the title bar) and solution mode (indicated by "Solved"). In edit mode you can add and remove cubes to and from the shape. The cube count (shown in the picture) displays how many cubes are left to be added. A Soma shape always has 27 cubes, so this number starts at 27, and goes down each time you add a cube. When it reaches 0, the shape has 27 cubes and the program can try to solve it.

When the program successfully solves a puzzle, it switches to solution mode. In this mode you can't add or remove any cubes, and the cubes are displayed in different colours to show how the Soma pieces make up the shape. The cube count is always 0 in solution mode.

Creating A Puzzle

The first step is to enter the shape you want to solve. Select Puzzle | New from the main menu. A single cube appears on the window - this is the first cube of the shape. Add more cubes to build up your shape by clicking with the left mouse button on faces of the existing cube(s). A new cube will be added to that face. You can remove cubes by clicking on them with the right mouse button.

While you're editing the shape, you can view it from different angles by using the arrow keys to rotate, and the Page Up and Page Down keys to zoom in and out. The Home key will jump back to the default viewing position if you get lost.

The cube count in the top right corner of the window shows how many cubes you still have to add. When the count reaches zero, you have 27 cubes and you're ready to solve it.

Solving

When you want to solve the shape, select Puzzle | Solve from the main menu. A dialog box will appear. While the program is thinking, a little coloured cube will rotate on the dialog box (you might think that the cube, cute though it is, takes up CPU time and makes the program take longer to solve the puzzle. Oddly, I tried getting rid of the cube, and it made no measureable difference. Besides, it looks cool.)

When the little cube stops rotating, and the 'Show Solution' and 'Get Hint' buttons are enabled, it means the program has solved the shape. Note that this might happen almost instantly if you have a fast PC, or if the shape you're solving happens to be easy for the program to solve.

If there is no solution, the program will display a message box telling you, and then the dialog will disappear.

Once the program has solved the shape, click the Show Solution button if you want to see the complete solution. The program will display each Soma piece in a different colour, to show you where they are in the shape. If you just want to get a hint, click the Get Hint button. The program will still show all the cubes in gray, but when you click on one, it will change the piece which that cube is part of to colour. If you click on it again, it will change back to gray. By clicking on one or more pieces, you can see where they are in the solution. This should get you started solving the shape without giving it away.

If you want to change the puzzle after solving it, just choose Puzzle | Edit from the main menu to switch the program back to edit mode.

I usually run this program on a Pentium 200mhz, and it never takes more than 8 seconds to solve a shape or report that there is no solution. The time varies depending on the structure of the shape, though, so you might happen to try a shape which takes a bit longer.

Saving & Opening

Once you've solved the shape, you can save it to a file. Select File | Save from the main menu, and select a file to save to. The program will display a dialog which allows you to change the name of the puzzle before saving. When you click OK on this dialog, the program will check that there is no existing puzzle in the file you selected which has the same name. If there is, it will warn you and let you enter a different name. Otherwise it will go ahead and save the puzzle. You can have as many puzzles as you like in a file, so long as each one has a unique name.

Puzzles are saved in ASCII text files, using a special format. The format is described fully at Thorlief Bundgaard's Soma web site at http://www.fam-bundgaard.dk/SOMA/SOMA.HTM. This web site also contains another Soma solver program, which uses the same format.
The Solver.zip file comes with a demo figure in a file called "Sample.htm"

Note that you can only load and save solved shapes. When the open a puzzle, the program automatically switches to solution mode if it wasn't already in it, and you can only save puzzles from solution mode. Being able to solve unsolved partial shapes is a potentially useful feature which I may add someday (see For the future).

Options

Selecting Options from the main menu will produce a dialog which lets you various options for the application. There are three:

1. Rotation increment. This is the angle (in radians) which the cubes rotate when you press the arrow keys. If you increase this value the cubes will rotate faster.

2. Motion increment. This is distance which the view of the puzzle zooms in and out when you press the Page Up or Page Down keys. A single cube has a dimension of 1, so if this value were set to 1 it means the view would zoom by the width of one cube whenever you pressed Page Up or Page Down.

3. The path to the help files. Normally the help files are stored in a subdirectory called Help from the directory where the program is. You only need to change this if you've moved the help files somewhere else.

What Is The Soma Cube?

The Soma Cube was invented by Danish writer and scientist Piet Hien. It is rather like a 3D version of Tangrams: there are 7 Soma pieces, each made up of 3 or 4 cubes joined together in different ways.



Just like Tangrams, you use these 7 basic pieces to form larger shapes. The most common shape is a 3x3x3 cube, but there are hundreds of other shapes which can be formed. Here's just a few:



For an extensive list, plus a more detailed description of the Soma Cube and it's history, see Thorlief Bundgaard's web site at:

http://www.fam-bundgaard.dk/SOMA/SOMA.HTM

For The Future

The program is currently limited to solving standard 27-cube shapes. I'd like to make be able it solve partial shapes (with less than 27 cubes, made up of 6 or less of the Soma pieces) and also shapes made up of multiple sets of Soma pieces - eg. a 54-cube shape made up from two of each piece.

Presently the program only finds one solution to a particular shape. Many shapes have multiple solutions (the standard 3x3x3 cube, for instance, has over 200 distinct solutions), and I want to enable the program to find them all.