Rubik invented many "mathematical" toys in the eighties. Rubik's cube was the most popular, but Rubik's snake is also common in the hands of today's children. This processing scripts is a demo on how you could use processing to render the Rubik's snake.
This script allows you to use onscreen controls to select a prism and rotate it.