A couple people have asked me how I create the drawings of the puzzles that you see here, such as the one in the frame below. The answer is that I use a free ray-tracing program called povray and a few python programs that I wrote myself. I am making these python programs freely available here. These were written one weekend a few years ago; they have shortcomings but may still be useful.

Packing a 4x4x4 with 3 F-pentacubes and 2 G-heptacubes



The two python programs I wrote: Three files related to the example above: The python programs run from a command-line shell, such as bash. You will need to have python installed on your machine. You will also need to install povray.

The puzzle description format is described at the top of solution_to_pov_pieces. Basically you name the pieces anyway you want and show the name of the piece occupying each cell. Names are separated by whitespace across a line, and blank lines separate layers. solution_to_pov_pieces will figure out the shape of each piece from this, will assign colors to pieces so that neighboring pieces have different colors, and will also decide what order to draw the pieces. It is actually not that great at piece ordering, but for small puzzles it is usually OK (it needs a better heuristic for determining which cells obscure which other cells). Coloring and piece order can be overridden in the input file (perhaps someday I will post an example here showing that).

Solution_to_pov_pieces also provides other command-line arguments to get the drawings to come out right. It has settings for camera distance and camera translation (≈ position). The defaults are set up for a 4x4x4 puzzle. For larger puzzles you will need to move the camera farther away. I recommend the --noclock option initially (so that only the final image will be drawn), using povray's width=100 height=100, until you get the camera settings right.

Anyway, to convert the puzzle description to a series of images, do this:
    ./solution_to_pov_pieces.py puzzle.txt
    time povray puzzle.ini width=200 height=200
To create the html files that go along with it, do this:
    ./make_solution_html.py \
        "Packing three F-pentacubes and two G-heptacubes into 4x4x4" \
        --index="puzzle01.html" \
        --solution="puzzle10.html" \
        "puzzle%02d.html" \
        "puzzle%02d.png" \
        10