Intro: Chinese Rings Puzzle
This puzzle is my version for Arduino of the centenial Chinese Rings Puzzle.
It is very simple to play and it is an example of a combinatorial puzzle and lots of patience and concentration is required to solve it.
The objective is to disentangle the long loop from all nine rings and the solution takes 341 moves (minimum possible).
Once you learn the method to solve the puzzle, you will see that is very easy to play it!
This project is very simple to be assembled, using only an Arduino UNO R3 and a LCD Keypad Shield.
It took me some time, but the code I developed reproduced exactly the same conditions and constraints as the original mechanical puzzle.
Let's do it and have a fun for a long time!!
Step 1: The Puzzle Story
He apparently gave it to his wife when he went to war so she would have something to keep her busy in his absence. The story relates that she forgot her sorrow while trying to solve the puzzle.
This puzzle or the Cardano's Rings was introduced in Europe by Girolamo Cardano in 1550 and it is perhaps the greatest mechanical puzzle of China.
The original puzzle consists of a long loop with a handle on one end that is interlocked with nine rings.
- A little of Math
The total of movements for a number of rings (n) is determined by the following equations:
1) When n is odd number:
T (n) = (2 ^ (n+1) − 1 ) / 3
2) When n is even number:
T (n) = (2 ^ (n+1) − 2 ) / 3
n T(n) 1 1 2 2 3 5 4 10 5 21 6 42 7 85 8 170 9 341 10 682 11 1365 12 2730 13 5461 14 10922 15 21845 16 43690 17 87381 18 174762 19 349525 20 699050
Step 2: Material List
- Arduino UNO R3
- LCD Keypad Shield
Step 3: The Code
The code is attached to this project.
Just upload it to your Arduino.
For this project you will need the Liquid Crystal library.
Step 4: Playing
At first line of LCD are shown the 09 rings and in the second line is shown the pointer.
You must use the keys LEFT & RIGHT to move the pointer and the key SELECT to remove or to insert a ring.
The LEFT key moves the pointer direct to the first ring position and the RIGHT key moves the pointer one position step by step.
The LCD also shows the total amount of moves, counting every time you press SELECT key to remove or insert a ring.
The key RESTART is used to start again the game at any moment.
At the end, after you solve the puzzle completely, you will see the "Congratulations" message and your grade.
If you complete the puzzle using the minimum moves (341) your grade will be 100.
Beyond that, your grade will be lower.
Note: You will see there are some restrictions to move the pointer and also to remove a ring, but this is part of the rules to solve the puzzle.