Enigmatic Code

Programming Enigma Puzzles

Puzzle 32: Cricket (4 teams)

From New Scientist #1083, 22nd December 1977 [link]

ABC and D are all to play each other once at cricket. After some — or possibly all — the matches have been played, A had got 18 points, B had got 17 and C had got 21. I’m afraid however, that I was not able to find out how many points D had got.

Points are awarded as follows:

To the side that wins — 10
To the side that wins on the first innings in a drawn match — 6
To the side that loses on the first innings in a drawn match — 2
To each side for a tie — 5
To the side that loses — 0.

Find the results of all the matches that were played.

[puzzle32]

One response to “Puzzle 32: Cricket (4 teams)

  1. Jim Randell 26 December 2018 at 9:28 am

    This puzzle is similar to Puzzle 59 and Enigma 3 (also set by Eric Emmet). And a similar program works to solve it.

    This Python program runs in 86ms.

    Run: [ @repl.it ]

    from itertools import product
    from enigma import printf
    
    # possible scores
    scores = ( (10, 0), (6, 2), (5, 5), (2, 6), (0, 10) )
    
    # possible the matches
    for (AB, AC, AD, BC, BD, CD) in product(scores, repeat=6):
      # check the scores
      A = AB[0] + AC[0] + AD[0]
      if A != 18: continue
      B = AB[1] + BC[0] + BD[0]
      if B != 17: continue
      C = AC[1] + BC[1] + CD[0]
      if C != 21: continue
      D = AD[1] + BD[1] + CD[1]
      # output the solution
      printf("AB={AB} AC={AC} AD={AD} BC={BC} BD={BD} CD={CD} [D={D}]")
    

    Solution: A vs B: A won on first innings; A vs C: C won on first innings; A vs D: A won; B vs C: tied; B vs D: B won; C vs D: C won.

    So D got a total of 0 points.

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: