### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 168,353 hits

Programming Enigma Puzzles

29 December 2011

Posted by on **From New Scientist #2777, 11th September 2010** [link]

Joe has 16 small square cards, eight black and eight white. On each card is one of the numbers 1 2 3 or 4. There is a 1 on four white cards (W1), a 1 on six black cards (B1), a 2 on two white cards (W2), a 2 on two black cards (B2), a 3 on one white card (W3) and a 4 on one white card (W4). All Penny has to do is place the cards on the grid (above right) with a 1 on a black card in the top right corner, so that the number on each card indicates how many black cards are immediately adjacent to it horizontally and vertically.

What cards did Penny place on A B C and D?

[enigma1612]

Advertisements

%d bloggers like this:

The following Python program tries all combinations of black and white cards in the remaining 15 squares, and runs in an acceptable time of 385ms.

Solution:A=W1, B=B1, C=B1, D=W1.