Skip to content
/ snake_toy Public

A Ruby script to solve the wooden snake toy (13 segments of various lengths connected with a piece of elastic that have to be bent into a cube)

Notifications You must be signed in to change notification settings

alxx/snake_toy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Ruby script that uses recursion in order to solve a puzzle.

This is a classic wooden puzzle made of 13 segments of various lengths. The shortest segment is a cube; other segments are twice as long, some are three times as long. The lengths of the segments is in main.rb at line 5.

The wooden segments are all interconnected using a strong elastic, through a channel pierced longitudinally through each segment. They are crested at the ends, allowing the elastic to bind two segments in various configurations, as you can see in the photos.

The object of the puzzle is to build a cube (or at least that's the object in this project.)

The algorithm found 7,236 solutions and they are all in results.txt. Alternatively you can run the script yourself: ruby main.rb. (Ruby 2.5 was used in development.)

In each solution, the numbers represent the index of the segment (0 is one of the ends, the little cube, and 12 is the little cube at the other end.)

Faces are number from near (face 0) to far (face 2).

This was a Sunday afternoon hobby project.

About

A Ruby script to solve the wooden snake toy (13 segments of various lengths connected with a piece of elastic that have to be bent into a cube)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages