Enigmatic Code

Programming Enigma Puzzles

Enigma 495: Lack of details

From New Scientist #1647, 14th January 1989 [link]

Four football teams are to play each other once. After some of the matches had been played a document giving a few details of the matches played, won, lost and so on was found. This time I am glad to say that, although it was rather a mess, all the figures given were correct. Here it is:

Enigma 495

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

Find the score in each match.

[enigma495]

One response to “Enigma 495: Lack of details

  1. Jim Randell 15 April 2019 at 7:42 am

    This Python program uses the [[ Football() ]] helper class from the enigma.py library. It runs in 108ms.

    Run: [ @repl.it ]

    from enigma import Football, digit_map, irange, concat
    
    # scoring system
    football = Football(games='wdlx', points=dict(w=2, d=1))
    
    # the columns of the table (digits in the table stand for themselves)
    table = dict(played='???2', l='?1??', d='0??1', points='?14?')
    
    # find possible match outcomes
    for (ms, d) in football.substituted_table(table, d=digit_map()):
    
      # consider goals for B = x, then goals against D = x + 3
      for x in irange(0, 6):
        gf = concat(5, x, 6, 3)
        ga = concat(2, 2, 7, x + 3)
    
        # find possible scorelines
        for ss in football.substituted_table_goals(gf, ga, ms, d=d):
    
          # output solution
          football.output_matches(ms, ss, teams="ABCD")
    

    Solution: The scores in the played games are: A vs C = 5-2; B vs C = 0-1; B vs D = 1-1; C vs D = 3-2.

    The A vs B and A vs D matches are not yet played.

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: