# Chinese Rings Puzzle With Arduino

### Introduction

Hello all,

The Chinese Rings Puzzle with Arduino is my version of a centennial Chinese 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 untangle 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!!

LAGSILVA

### The Puzzle Story

Stewart Culin in his book “Games of the Orient” records a story that the Chinese Rings puzzle was invented by the famous Chinese hero Mung Ming (A.D. 181 – 234).

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 moves 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
``````

### Material List

• Arduino UNO R3
• LCD Keypad Switch

### he Code

The code is attached to this project.

For this project you will need the Liquid Crystal library.

### Playing

The first line of LCD is 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.

For more detail: Chinese Rings Puzzle With Arduino