Enigmatic Code

Programming Enigma Puzzles

Puzzle 32: Cricket (4 teams)

From New Scientist #1083, 22nd December 1977 [link]

ABC and D are all to play each other once at cricket. After some — or possibly all — the matches have been played, A had got 18 points, B had got 17 and C had got 21. I’m afraid however, that I was not able to find out how many points D had got.

Points are awarded as follows:

To the side that wins — 10
To the side that wins on the first innings in a drawn match — 6
To the side that loses on the first innings in a drawn match — 2
To each side for a tie — 5
To the side that loses — 0.

Find the results of all the matches that were played.

[puzzle32]

One response to “Puzzle 32: Cricket (4 teams)”

1. Jim Randell 26 December 2018 at 9:28 am

This puzzle is similar to Puzzle 59 and Enigma 3 (also set by Eric Emmet). And a similar program works to solve it.

This Python program runs in 86ms.

Run: [ @repl.it ]

```from itertools import product
from enigma import printf

# possible scores
scores = ( (10, 0), (6, 2), (5, 5), (2, 6), (0, 10) )

# possible the matches
for (AB, AC, AD, BC, BD, CD) in product(scores, repeat=6):
# check the scores
A = AB[0] + AC[0] + AD[0]
if A != 18: continue
B = AB[1] + BC[0] + BD[0]
if B != 17: continue
C = AC[1] + BC[1] + CD[0]
if C != 21: continue
D = AD[1] + BD[1] + CD[1]
# output the solution