Rubik's Snake is a lesser-known toy (compared to the more famous cube) invented by Ernő Rubik.
I had already written code for rendering a snake in various configurations years ago, but only recently started exploring how to make it interactive, as a toy ought to be. There has been previous Mathematica-related work on the snake (e.g. this one); the difference in my implementation is that you can use dials (done via Experimental`AngularSlider) to rotate the segments, customize the number of segments (up to the 24 segments of the classical snake), and change the alternating colors of the segments as a bonus.
The code is a bit long, so instead of pasting the code here, I've attached a CDF file containing the Rubik's Snake GUI to this post.
To give some of the known patterns as examples, here is the "cobra" configuration:
Here is the "ball" configuration (guess the sequence for making this!):
More configurations to try can be found at websites dedicated to Rubik's Snake, like this one.
I also make a version a few years before from the view point of robot kinematics. Your different solution of GUI and GraphicsComplex is good for speed. One playful idea of Rubik's snake. Control the joints to transform for one sort of status to another. E.g. bar to ball. As all joints status are changing, constantly. It will look like a real snake.
Rubik's Snake Puzzle
- Congratulations! This post is now a Staff Pick as distinguished on your profile! Thank you, keep it coming!