Enter the maze

Winning at Nim: computers outwitting humans

Hamster nim screen shot

The game of Nim, derived from a Chinese game called Tsyanshidzi or "picking stones", is one of the first games where an "electronic brain" or "Artificial Intelligence" was able to consistently beat humans. At the 1939 World Exhibition in New York, the Nimatron, a Nim playing robot won 90 000 games out of the 100 000 it played. In 1951 a second computer called Nimrod was exhibited at the Festival of Britain and the Berlin Trade Fair. According to Alan Turing, the father of modern computer science it was so popular that people ignored the free beer (in Berlin!!!...though the beer was English beer, I suppose). The beer was at the other end of the same room but people instead watched the "electronic brain" beat its human competitors. In part the excitement was caused because on the first day Nimrod had beaten Ludwig Erhard, the German Federal Minister for Economic Affairs, three times in a row. The age of computers outwitting humans had started.

Our Hamster Nim plays in the same way - can you do better than a Minister and beat it?

"I'm not afraid to admit that I'm afraid..."

50 years later computers can now routinely beat humans at many games including chess, leading to the famous quote of world chess champion Garry Kasporov's, arguably the best human chess player ever, "I'm not afraid to admit that I'm afraid". Chess-playing program, Deep Blue's win against him was the first time a computer had beaten the human World chess champion ever in a tournament rules game.

Winning at Nim

There is a beautiful way (an "algorithm") to always win (well most of the time anyway)... the way used by Nimatron, Nimrod and our Hamster Nim. All you need is to know a little binary maths - something that computers do well as it is the maths that underpins computer science - and know how to use a special operation known as XOR (which incidentally can also be used to make uncrackable secret codes). Play some games against our Hamster Nim Master to get a feel for Nim. You can watch how our Hamster Nim plays. Maybe you can work out the secret of Nim yourself, but if not, read about the secret of Nim.