### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 178,002 hits

Advertisements

Programming Enigma Puzzles

10 August 2013

Posted by on **From New Scientist #2564, 12th August 2006**

Amber and Ben have a new game. They lay out a row of three coins, all showing heads. They take it in turns, beginning with Amber, to turn one of the coins over. They must not turn a coin so as to produce a pattern of heads and tails which is the same as a pattern that has occurred earlier in the game.

For example, if Amber’s first move is to THH then Ben cannot move back to HHH. The first person who cannot make a move is the loser.

Question 1.If both players play as well as possible, who is the winner?They now change the game by playing with a row of four coins, but the other rules are unchanged.

Question 2.If again, both play as well as possible, who is the winner?They now change the rules again. They go back to three coins, but the first person who cannot make a move is the winner.

Question 3.If again, both play as well as possible who is the winner?

[enigma1404]

Advertisements

%d bloggers like this:

I found this one quite a satisfying problem to solve.

This Python program uses a recursive function to examine the game tree. It runs in 40ms.

Solution:1. Amber; 2. Amber; 3. Ben.