Enigmatic Code

Programming Enigma Puzzles

Tantalizer 417: King Kong

From New Scientist #967, 18th September 1975 [link]

This ancient Ethiopian game is a sort of Rugby football played with a melon. There are just two ways of scoring. By tossing the melon over a branch of your opponent’s Haha tree you score a King, worth five points. By passing it through his ring of plaited Oompah grass you score a Kong, worth three points. If the match is drawn, each party collects an ox. Otherwise the winner gets two oxen.

Each of the four regions sends its champion to the annual Tourney of the Winds, where each plays a single against each of the others. This year 44 points were scored in total, of which North gained 10, East 15 and South 11. 13 points were scored against North and 9 against East. South drew at least two matches and no two teams received the same number of oxen.

What Kings and Kongs were scored in the match between North and West?


3 responses to “Tantalizer 417: King Kong

  1. Jim Randell 20 November 2019 at 8:37 am

    If 44 points were scored in total then West scored 8 points.

    I used the [[ Football() ]] helper class from the enigma.py library to solve this puzzle.

    The following Python program runs in 560ms.

    Run: [ @repl.it ]

    from enigma import express, irange, Football, printf
    # possible points scored in a match
    scores = list(n for n in irange(0, 22) if any(express(n, (3, 5))))
    # scoring system
    football = Football(games='wdl', points=dict(w=2, d=1))
    # choose match outcomes for S
    for (NS, ES, SW) in football.games(repeat=3):
      # S had at least 2 draws
      if (NS, ES, SW).count('d') < 2: continue
      # table for S
      tS = football.table([NS, ES, SW], [1, 1, 0])
      # remaining match outcomes for N
      for (NE, NW) in football.games(repeat=2):
        # table for N
        tN = football.table([NE, NS, NW], [0, 0, 0])
        if tN.points == tS.points: continue
        # and the remaining match
        for EW in football.games():
          # tables for E, W
          tE = football.table([NE, ES, EW], [1, 0, 0])
          tW = football.table([NW, EW, SW], [1, 1, 1])
          if len(set(x.points for x in (tN, tE, tS, tW))) != 4: continue
          # find scores in N's games
          for (sNE, sNS, sNW) in football.scores([NE, NS, NW], [0, 0, 0], 10, 13):
            if not all(x in scores and y in scores for (x, y) in (sNE, sNS, sNW)): continue
            # find scores in E's remaining games
            for (sES, sEW) in football.scores([ES, EW], [0, 0], 15, 9, [sNE], [1]):
              if not all(x in scores and y in scores for (x, y) in (sES, sEW)): continue
              # consider possible goals against W
              for aW in scores:
                # the score in the remaining match
                for (sSW,) in football.scores([SW], [1], 8, aW, [sNW, sEW], [1, 1]):
                  if not all(x in scores for x in sSW): continue
                  # verify goals for/against S
                  (fS, aS) = football.goals([sNS, sES, sSW], [1, 1, 0])
                  if not(fS == 11 and aS + aW == 22): continue
                  printf("NE={NE}:{sNE} NS={NS}:{sNS} NW={NW}:{sNW} ES={ES}:{sES} EW={EW}:{sEW} SW={SW}:{sSW}")
                  printf("N = {tN}")
                  printf("E = {tE}")
                  printf("S = {tS}")
                  printf("W = {tW}")

    Solution: The North vs. West match North won by 2 kings (10 points) to 1 king (5 points).

    The full outcomes are:

    N vs E = 0 – 3
    N vs S = 0 – 5
    N vs W = 10 – 5
    E vs S = 6 – 6
    E vs W = 6 – 3
    S vs W = 0 – 0

    The number of oxen won is: N=2, E=5, S=4, W=1.

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: