Enigmatic Code

Programming Enigma Puzzles

Enigma 317: League addition

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.

Enigma 317

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

[enigma317]

Advertisements

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
    
      printf("AB={AB} AC={AC} AD={AD} BC={BC} BD={BD} CD={CD}")
      printf("A={A}")
      printf("B={B}")
      printf("C={C}")
      printf("D={D}")
      printf()
    

    Solution: Appleton beat Damson’s. Banana beat Damsons.

    The remaining matches (A v B, A v C, B v C, C v D) were draws.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: