Rubik's Snake
X Y Z
Drag to rotate  ·  Scroll to zoom

Rubik's Snake Help

Controls

DragRotate the figure
Shift+drag / right-dragPan
Scroll / pinchZoom
Two-finger swipePan (touch)
X / Y / Z dragClick and drag left/right on an axis label to rotate around that axis. Each label controls exactly one angle; values stay in sync with canvas drag and snap to ±180° on release.

Code bar

NameFigure name — populated when a figure is loaded; edit before saving
Code boxJoint angles: 0=straight 1=90° 2=180° 3=270°. One digit per joint (segments−1 digits total)
Extra digitClosing digit of a closed loop — shown automatically when the snake closes
CAppears when the figure's code is not equivalent to its mirror image (swap 1↔3 in joints). Click to toggle the mirror view. A superscript * means the 3D shape is geometrically chiral — it cannot be rotated to match its mirror image.

Button column

? HelpThis help page
CollectionsOpens a popup menu listing all built-in figure sets. Click a name to show its figures in the left panel; click again to hide. Button is highlighted while a collection is active.
Load fileLoad one or more .txt figure files; each appears as a tab in the left panel.
SaveSave the current name and code to My List. Updates the entry if the name already exists.
CopyCopy the current code to the clipboard.
ImageDownload a PNG image of the current view. The file is named after the current figure.
⟳ RotateToggle auto-rotation
1,2,3Toggle segment number labels. While on, labels persist through Alt+rotations — each segment keeps its number. Numbers also appear temporarily on self-intersection. Disabled in Tube and Line modes.
TubeToggle tube view: renders the snake as a continuous tube following the center path of each segment.
LineToggle line view: renders the snake as a 3D polyline — cylinders connecting the face centers of adjacent segments, with spheres at each joint.
RadiusTube or line thickness. Editable when Tube or Line is active. Default: 0.12 for tube (min 0.02), 0.06 for line (min 0.01).
Coll:Strict / Coll:LooseToggle collision detection algorithm. Strict (default) uses the precise prism geometry. Loose uses tube endpoint proximity — useful when exploring configurations that would be flagged as intersecting in strict mode.
EditToggle edit mode: enables code editing. The cursor position controls how much of the snake is shown at full brightness — segments up to the cursor are fully lit, the rest are dimmed. A black square marks the cursor position on the snake. Edit mode can also be entered by clicking in the code box. Auto-rotation stops on entry.

Cursor mark — when you leave the code box, your cursor position is saved as a gold bar. Clicking the code box returns the cursor there.
ComposeToggle compose mode: attach a closed loop onto the current figure. Snake a is the base figure; snake b is the closed loop to attach. Click any closed figure in a list to select it as snake b. Choose the joining segments using the two selectors. The result is shown live; snake b's segments appear in a distinct color. Each selector change is individually undoable.

↔ (reverse) — next to the b selector. Toggles a geometrically distinct attachment: snake b orientation is reversed. For a given (a, b) pair this can produce a result unreachable by any normal composition. Resets when a new loop is selected.

C — next to the reverse button. Swaps 1↔3 in all joints of snake b (mirror image). Can be combined with reverse.

Join — finalizes the composition: the result becomes the new base snake and the right panel resets to accept the next loop.

Adding more loops — after the first composition, clicking another closed figure adds it as a second loop attached to the result, and so on. Each added loop appears in the right panel; only the last one has active controls. Clicking ✕ on the last entry removes it (undoable).

Exit — ends the compose session. If any joins were made, offers to download a log: a plain-text record of the base snake, each loop with its a/b/↔/C settings, and the result code after each step. You can edit the filename before downloading. Clicking ⊕ or Edit exits immediately without a log prompt.
↩ / ↪Undo / Redo the last code edit or composition. Also Ctrl+Z / Ctrl+Y (or Cmd). Redo is cleared when a new edit is made.

Edit mode shortcuts

zReplace all digits from the cursor to the end with 0s. Undoable.
^0–3Insert a digit at the cursor, shifting the rest right; the last digit is dropped. Undoable.
^→Move cursor to the end of the code box (fully lit snake)
^←Move cursor to the beginning of the code box (only first segment lit)
↑ / ↓Increment / decrement the digit just left of the cursor (wraps 0–3), updating the snake immediately
→ / ←Move the cursor one step, lighting one more or fewer segment
Alt+→ / Alt+←Cyclic rotation (closed loops) or shift with 0-padding (open snakes): changes which segment is first

Left panel

Click tabShow / hide the figures in a loaded file
My listYour personal working list — appears once the first figure is saved. Name the list using the text box.
↓ DownloadDownload My List as a .txt file using the list name
Click figureLoad and render it
× buttonRemove a figure from the list (undo available for 5 seconds)
↑ ↓ arrowsNavigate the figure list
EnterLoad the highlighted figure

Figure file format

One figure per line: Name code
Name must have no spaces. Code is digits 0–3.
Blank lines and lines starting with # are ignored.

Example:
# My figures
Ball 11331311313311331311313
Straight 00000000000000000000000

Version: