### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,314)
- misc (3)
- project euler (2)
- puzzle (78)
- puzzle# (21)
- site news (54)
- tantalizer (80)
- teaser (7)

### Site Stats

- 217,167 hits

Programming Enigma Puzzles

20 February 2019

Posted by on **From New Scientist #986, 5th February 1976** [link]

The landlord of the Compleat Idiot likes to add spice to the day’s angling. Each angler starts by predicting everyone’s catch and there is a double scotch for each correct prediction afterwards. Yesterday no one was right about anyone, each man having predicted too few for those who beat him and too many for those who did not (including himself). Everyone caught at least one fish and all caught a different number. If I tell you the predictions (predictors down the left, persons predicted for across the top), can you work out the actual catches?

[tantalizer435]

%d bloggers like this:

This Python 3 program reuses the [[

Interval()]] class I wrote forEnigma 70andEnigma 201.The program considers the possible orders of the anglers (from smallest catch to largest catch), and sees if intervals can be created that satisfy all the predictions.

It runs in 89ms.

Run:[ @repl.it ]Solution:The actual catches are: A=7, B=1, C=6, D=2, E=11, F=8.There is only one order that gives non-empty intervals for each angler. That is (B, D, C, A, F, E), from smallest catch to largest catch. And in this case each of the intervals defines a single possible amount.