### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,183)
- misc (2)
- project euler (2)
- puzzle (46)
- site news (46)
- tantalizer (49)
- teaser (3)

### Site Stats

- 184,820 hits

Advertisements

Programming Enigma Puzzles

27 February 2017

Posted by on **From New Scientist #1535, 20th November 1986** [link]

I emerged from the impenetrable jungle into a clearing, at the centre of which were 21 stones laid on the ground to form a triangle.

Just then, three native girls approached the stones; each wore a coloured sarong, one red, one blue, one white. They painted the six stones in the bottom row, white, white, blue, blue, red, red, in that order from left to right, and placed a coconut on the single stone in the top row. My guide explained that this was a traditional game. The girls would go and turn in the order red, white, blue, red, white. At each turn the girl would move the coconut to a stone which touched the coconut’s present stone and which was on a lower row. The game ended when the coconut reached the bottom row, and the colour of its final stone indicate the winner.

My guide knew the girls and said that if red could not win she would try to help white to win, similarly white would help blue and blue would help red: all the girls knew this.

After the game they exchanged the colours on two of the stones and played again. Blue won the second game.

Who won the first game and what was the row of colours for the second game?

[enigma386]

Advertisements

%d bloggers like this:

We can solve the puzzle by playing the game backwards.

White makes the final move to the bottom row. If the coconut is in the leftmost position then it is only possible to move it to a white stone. Likewise if the coconut is on the middle stone it can only be moved to a blue stone, and if it is on the rightmost stone it can only be moved to a red stone.

So, White only has to make a choice if the coconut is in the 2nd or 4th positions (counting from the left). If it’s in the second position (a choice between White and Blue), she chooses White (so that she wins). If it’s in the fourth position (a choice between Blue and Red), she favours Blue.

So we can colour the row of five stones: White, White, Blue, Blue, Red, and then continue on to the row of four stones, by considering the actions of Red.

We continue in this way until we have coloured the topmost stone, and this indicates the winner of the game.

This Python program runs in 42ms.

Solution:The first game is won by White. The second game started with colours: White, Red, Blue, Blue, Red, White.The colouring of the stones for the first game is:

And for the second game: