### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,115)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

30 January 2013

Posted by on **From New Scientist #1195, 21st February 1980** [link]

The little Buggins were given a games-playing robot for Christmas and are fascinated still. Among its games is a fearsome version of the old Victorian pastime now marketed as Mastermind. The robot thinks of a number and you try and deduce what it is by proposing a series of numbers with the right number of digits. After each guess the robot shows one flashing light (

F) for each correct digit correctly placed and one steady light (S) for each correct digit wrongly placed. Thus, if it chose 98766 and you guessed 66765, it would showFFS.The machine can handle any number of digits up to nine but the Buggins kids are only human and are having trouble enough with five-digit numbers. Here, for instance, is a series of five guesses and the robot’s comments:

1 2 3 4 5FFS3 1 6 2 0SSS7 3 8 9 0FS8 9 5 1 4F6 0 1 7 1FSSWhat do you reckon the robot’s number is?

**Enigma 147** and **Enigma 262** are also called “Think of a number”.

[enigma52]

Advertisements

%d bloggers like this:

My original solution was just to try all candidate 5-digit numbers against the guesses to see if they produced the right scores, but this took a couple of seconds. Here’s a recursive solution that uses the “right digit in the right place” information to test a much reduced set of candidate 5-digit numbers. It runs in 43ms.

Solution:The robot’s number is 72311.