Enigmatic Code

Programming Enigma Puzzles

Enigma 354: Football again… and why, why, why?

From New Scientist #1503, 10th April 1986 [link]

In the following football table and addition sum letters have been substituted for digits (from 0 to 9). The same letter stands for the same digit wherever it appears and different letters stand for different digits.

The three teams are eventually going to play each other once — or perhaps they have already done so.

Enigma 354 - Table

(Two points are given for a win and one point to each size in a drawn match).

Enigma 354 - Sum

Find the scores in the football matches and write the addition sum out with numbers substituted for letters.

[enigma354]

Advertisements

One response to “Enigma 354: Football again… and why, why, why?

  1. Jim Randell 22 July 2016 at 8:54 am

    A similar problem to Enigma 7.

    This Python program uses the Football.substituted_table*() and SubstitutedSum() solvers from the enigma.py library, both written to make solving such problems less tedious. It runs in 42ms.

    from enigma import Football, SubstitutedSum
    
    # scoring system
    football = Football(points={ 'w': 2, 'd': 1 })
    
    # labels for the teams
    (A, B, C) = (0, 1, 2)
    
    # solve the table
    for (matches, d) in football.substituted_table({ 'played': 'ggg', 'w': '??r', 'points': 'p?p' }):
    
      # solve the sum to get s, x, y
      for s in SubstitutedSum(['ry', 'sy'], 'xy', l2d=d).solve():
    
        # and determine the scores in the matches
        for scores in football.substituted_table_goals('xys', 'php', matches, d=s, teams=[A, C]):
    
          # and check goals for/against B
          (y, h) = football.goals([scores[(A, B)], scores[(B, C)]], [1, 0])
          if y != s['y'] or h > 9 or h in s.values(): continue
    
          # output the matches
          football.output_matches(matches, scores, teams='ABCD', d=s)
    

    Solution: The scores in the matches are: A vs B = 5-0; A vs C = 3-3; B vs C = 0-4. The addition sum is 10 + 70 = 80.

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: