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.
Have fun!
Attachments: