# Enigmatic Code

Programming Enigma Puzzles

From New Scientist #1465, 18th July 1985 [link]

In the fruiterers football league, each of the four teams plays each of the others once. Three points are awarded for a win and one for a draw. The table below shows part of the League Table at the end of last season. As usual, different letters stand consistently for different digits.

The four teams, Appleton Rovers, Banana Splits, Cox’s Pippins and Damsons United are in order of merit, goal differences having to be used just once to divide them.

List all the victories last season (e.g. X beat Y, P beat Q, etc).

[enigma317]

### One response to “Enigma 317: League addition”

1. Jim Randell 30 October 2015 at 8:47 am

Another football puzzle. But this one is set by Susan Denham, not Eric Emmet.

It is relatively easy to solve using the Football() helper class from the enigma.py library. This Python program runs in 72ms.

```from enigma import Football, printf

# scoring system
football = Football(points={ 'w': 3, 'd': 1 })

# match outcomes
for (AB, AC, AD, BC, BD, CD) in football.games('wdl', repeat=6):

A = football.table([AB, AC, AD], [0, 0, 0])
B = football.table([AB, BC, BD], [1, 0, 0])
C = football.table([AC, BC, CD], [1, 1, 0])
D = football.table([AD, BD, CD], [1, 1, 1])

(a, b, c, d) = (A.w, B.l, C.d, D.l)
if len(set((a, b, c, d))) != 4: continue
if A.points != 2 * b + c + d: continue
if not(A.points >= B.points >= C.points >= D.points): continue
if len(set((A.points, B.points, C.points, D.points))) != 3: continue