Enigmatic Code

Programming Enigma Puzzles

Puzzle 33: Football and addition (Letters for digits)

From New Scientist #1084, 5th January 1978 [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.

puzzle-33

(2 points are given for a win and 1 point to each side in a drawn match).

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

This completes the archive of puzzles from 1978. There is now a full archive of puzzles from New Scientist from January 1978 to September 1988, and also from May 1999 up to the final Enigma puzzle in December 2013. Together with the Tantalizer puzzles from Mar 1976 to May 1977, there are a total of more than 1350 puzzles available on the site.

There are 31 puzzles remaining to post from the Puzzle series, all from 1977, which fill the gap after the final Tantalizer puzzle.

[puzzle33]

One response to “Puzzle 33: Football and addition (Letters for digits)

  1. Jim Randell 19 December 2018 at 7:46 am

    This Python program uses the [[ Football() ]] and [[ SubstitutedSum() ]] classes from the enigma.py library. It runs in 170ms.

    Run: [ @repl.it ]

    from enigma import Football, SubstitutedSum, irange, update
    
    # the scoring system
    football = Football(points=dict(w=2, d=1))
    
    # the teams
    (A, B, C) = (0, 1, 2)
    
    # the alphametic sum
    p = SubstitutedSum(['rg', 'ph'], 'hm')
    
    # solve the sum (to get: g h m p r)
    for d in p.solve():
    
      # solve the table (to get: d)
      for (ms, d2) in football.substituted_table(dict(played='dg?', d='??m', points='?r?'), d=d):
    
        # choose a value for t
        for t in set(irange(0, 9)).difference(d2.values()):
          d3 = update(d2, [('t', t)])
    
          # determine the scores (using teams A, C)
          for ss in football.substituted_table_goals('r?g', 't?p', ms, teams=[A, C], d=d3):
    
            # check B.goals_for = h
            (fB, aB) = football.goals([ss[(A, B)], ss[(B, C)]], [1, 0])
            if not(fB == d3['h']): continue
    
            # output solutions
            football.output_matches(ms, ss, teams="ABC", d=d3)
    

    Solution: The scores in the played matches are: A vs B = 4-5; B vs C = 3-2. The A vs C match is not yet played. The sum is: 42 + 38 = 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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: