Tagged: by: R. J. Pocock Toggle Comment Threads | Keyboard Shortcuts

  • Unknown's avatar

    Jim Randell 4:31 pm on 13 June 2021 Permalink | Reply
    Tags: by: R. J. Pocock,   

    Brain-Teaser 35: After-lunch golf 

    From The Sunday Times, 19th November 1961 [link]

    Gee and Jay play — for £1 the match, 5s. a hole, and 1s. a stroke — a golf match of nine holes which is decided on the ninth green. Neither takes less than four or more than nine strokes at any hole and the
    results vary for every hole.

    Gee wins five holes and the match, and takes 22s. off his opponent, but had the result at the last hole been reversed he would have lost 10s.

    At the eighth hole all the strokes travel an exact number of yards straight towards the pin, but whilst each of Gee’s travels one half the distance of his previous stroke, each of Jay’s goes one quarter the distance of its predecessor.

    (i) In how many strokes did Gee complete the round?
    (ii) What is the length of the eighth hole?

    [teaser35]

     
    • Jim Randell's avatar

      Jim Randell 4:31 pm on 13 June 2021 Permalink | Reply

      I struggled to find a unique solution for this puzzle, and had to make several assumptions along the way. Maybe I just don’t know enough about golf.

      Let’s start by looking at the 8th hole:

      If G makes n strokes, and the distance of the final one is x, then the total distance is:

      x + 2x + 4x + … + (2^n)x = (2^n − 1)x

      And if J makes m strokes, and the distance of the final one is y, then the total distance is:

      y + 4y + 16y + … + (4^m)y = (4^m − 1)y / 3

      So the overall distance of the hole must be some multiple of: lcm(2^n − 1, (4^m − 1) / 3)

      The following values work (for holes with a distance of less than 1000 yards):

      n=4 m=4: dist = 255k; Gs=(136, 68, 34, 17)k, Js=(192, 48, 12, 3)k
      n=5 m=5; dist = 341k; Gs=(176, 88, 44, 22, 11)k, Js=(256, 64, 16, 4, 1)k
      n=8 m=4; dist = 255k; Gs=(128, 64, 32, 16, 8, 4, 2, 1)k, Js=(192, 48, 12, 3)k

      If we limit the length of a hole we can reduce the possibilities, but even the smallest possible distance (255 yards) has 2 options for the score.

      As far as the actual match goes I’m assuming the winner of the match is the player who won the greatest number of individual holes, and the loser pays the winner £1 (= 20s), and for each individual hole the loser of each hole pays the winner 5s, plus 1s per stroke for the difference in strokes.

      I further assumed that “the results vary for each hole” mean that no score for any hole is repeated.

      We know that G wins 5 holes (including the final hole), and hole 8 is either drawn, or G loses it by 4 strokes.

      If the 8th hole is drawn there are 2 possibilities (scores from G’s perspective):

      8th hole = 4-4; Gs wins = 4-5, 5-6, 6-7, 7-8, 8-9; other holes = 8-4, 9-5, 9-4
      8th hole = 5-5; Gs wins = 4-5, 5-6, 6-7, 7-8, 8-9; other holes = 8-4, 9-5, 9-4

      The first gives G a total of 60 strokes, and J a total of 52.

      G wins 20 + (5 − 3)×5 + (52 − 60) = 22 shillings.

      And if the result of one of G’s wins (on the last hole) was reversed, there would be no winner on holes (each won 4, and 1 was drawn), so the match is drawn, and only money for the number of strokes changes hands. G has a total of 61 strokes, and J a total of 51 strokes, so G loses 10s. (Although I think J could argue that in this case he won the match).

      The second gives G a total of 61 strokes, and J a total of 53.

      Again, if the result of one of G’s wins is reversed, G’s total goes down by 1 stroke and J’s goes up by 1, so G loses 10s.

      So, if we limit the maximum possible distance of a hole to 340 yards, then only the first of these options remains, and gives the solution:

      Solution: (i) Gee completed the round in 60 strokes. (ii) The 8th hole was 255 yards long.

      Which is the published solution.

      Like

      • Jim Randell's avatar

        Jim Randell 10:35 am on 15 June 2021 Permalink | Reply

        Here is a Python program that solves the puzzles according to the assumptions described in my previous comment.

        It runs in 86ms.

        Run: [ @replit ]

        from enigma import irange, subsets, update, lcm, group, unpack, multiset, join, printf
        
        # possible strokes per hole
        strokes = irange(4, 9)
        
        # consider the number of strokes on the 8th hole (G=x, J=y)
        def hole8():
          for (x, y) in subsets(strokes, size=2, select="M"):
            # calculate minimal distance
            tx = sum(pow(2, n) for n in irange(0, x - 1))
            ty = sum(pow(4, n) for n in irange(0, y - 1))
            d = lcm(tx, ty)
            if d < 1000:
              printf("[hole8: G={x} J={y}; dist = {d}k; Gs={Gs}k Js={Js}k]",
                Gs=tuple(pow(2, n) * d // tx for n in irange(0, x - 1))[::-1],
                Js=tuple(pow(4, n) * d // ty for n in irange(0, y - 1))[::-1],
              )
              yield (x, y)
        # collect hole 8 scores by score
        score = unpack(lambda x, y: y - x)
        h8s = group(hole8(), by=score)
        
        # collect possible wins/losses
        scores = group(subsets(strokes, size=2, select="M"), by=score)
        
        # calculate the gain for a sequence of holes
        def gain(hs):
          # total gain (shillings), difference (in holes)
          T = d = 0
          for x in hs:
            if x < 0:
              # G wins the hole
              T += 5 - x
              d += 1
            elif x > 0:
              # G loses the hole
              T -= 5 + x
              d -= 1
          if d > 0:
            # G wins the match (on holes, not strokes)
            T += 20
          elif d < 0:
            # G loses the match
            T -= 20
          return T
        
        # find scores with stroke differences in ds
        def complete(ds, ss):
          if not ds:
            if len(set(ss)) == len(ss):
              yield ss
          else:
            (k, v) = ds[0]
            for xs in subsets(scores[k], size=v, fn=list):
              yield from complete(ds[1:], ss + xs)
        
        # output holes and total strokes
        def output(hs, ss):
          holes = list()
          G = J = 0
          for (h, (x, y)) in zip(hs, ss):
            if h > 0: (x, y) = (y, x)
            holes.append((x, y))
            G += x
            J += y
          printf("{holes} -> G={G} J={J}", holes=join((f"{x}-{y}" for (x, y) in holes), sep=", ", enc="()"))
        
        # G wins 5 holes (including the final one)
        for Gw in subsets([-1, -2, -3, -4, -5], size=5, select="R"):
          # G does not win any of the other 4 holes
          for Gl in subsets([0, 1, 2, 3, 4, 5], size=4, select="R"):
            # calculate G's winnings
            hs = list(Gw + Gl)
            # hole 8 is 0 or -4
            if not any(k in hs for k in h8s.keys()): continue
            w = gain(hs)
            if w != 22: continue
        
            # look for a 9th hole, which if swapped would give -10s
            for x in set(Gw):
              hs_ = update(hs, [hs.index(x)], [-x])
              w_ = gain(hs_)
              if w_ != -10: continue
        
              # count the scores, and reject any collection that would require a duplicate score
              s = multiset.from_seq((abs(x) for x in hs))
              if any(s.count(k) > len(scores[k]) for k in s.keys()): continue
        
              # choose a hole 8
              for (i, h8) in enumerate(hs):
                for s8 in h8s.get(h8, []):
                  # count the remaining scores
                  for ss in complete(list(s.difference([abs(h8)]).items()), [s8]):
                    # output solution (hole 8 first)
                    output([h8] + hs[:i] + hs[i + 1:], ss)
        

        The distance for the 8th hole is limited to below 1000 yards, so the program produces two possible answers.

        In the output the holes are not listed in play order, rather hole 8 comes first, then the remaining holes, starting with those that G won.

        Like

      • Jim Randell's avatar

        Jim Randell 5:49 pm on 19 June 2021 Permalink | Reply

        With Teaser 36 the following was published:

        In Brain-Teaser No. 35 (Sunday, November 19) owing to the omission of the result of the eighth hole (halved in four) several alternative solutions became possible. No reader who submitted any of these was excluded from the prize.

        Which I think means we are take it that the result of the eighth hole was a draw, each player taking 4 strokes.

        With this additional information we can reduce the number of possible solutions (although we still need to limit the distance of the eighth hole, or the individual strokes, to deduce a unique distance).

        Like

    • Jim Olson's avatar

      Jim Olson 9:14 pm on 13 June 2021 Permalink | Reply

      I’m not following the total score for each. If Gee wins the match then he has the lowest total strokes. In the analysis presented Jay should have won the match. It is not determined by the number of holes won. I understand the assumption you made but that is not golf rules.

      Like

      • Jim Randell's avatar

        Jim Randell 11:02 pm on 13 June 2021 Permalink | Reply

        I tried various things to try and get a unique solution, and this was the only way I found. Looking on Wikipedia [link] it seemed to be allowed (“match play” vs “stroke play” – I did start off using the latter, but didn’t get anywhere).

        I don’t think a modern Teaser puzzle would be published that didn’t have at least a brief description of the scoring system that is to be used. But this one is from 60 years ago.

        Like

    • Jim Olson's avatar

      Jim Olson 2:18 am on 14 June 2021 Permalink | Reply

      I agree your interpretation is what the setter had in mind. However, after many years of playing golf In tournaments and at golf clubs the tournament or match was won by the golfer with the lowest number of total strokes. The setter should have made it clear how the scoring for the match winner was to be computed. It would have saved quite a bit of time.

      Like

  • Unknown's avatar

    Jim Randell 9:40 am on 13 April 2021 Permalink | Reply
    Tags: by: R. J. Pocock   

    Brain-Teaser 30: [Football table] 

    From The Sunday Times, 15th October 1961 [link]

    In a football tournament each country played each other country twice, the scores in all twelve matches being different.

    The records for the top and bottom teams were:

    England beat Wales twice by the same margin as she beat Ireland once.

    The sum of the aggregate number of goals scored against Scotland, who finished second, and Ireland was 20.

    What were the respective scores in the Ireland vs. Scotland matches?

    This puzzle was originally published with no title.

    [teaser30]

     
    • Jim Randell's avatar

      Jim Randell 9:41 am on 13 April 2021 Permalink | Reply

      This seems to be the earliest “football table” Teaser.

      We are told that the sum of Scotland and Ireland’s “goals against” values is 20, which means the total of the “goals against” column must be 38. And so the sum of Scotland and Ireland’s “goals for” values must be 38 − (16 + 8) = 14.

      The following Python program uses the [[ Football() ]] helper class from the enigma.py library. It runs in 1.22s.

      from itertools import product
      from enigma import (Football, ordered, chunk, subsets, irange, multiset, join, printf)
      
      # scoring system
      football = Football(games="wdl", points=dict(w=2, d=1))
      
      # identify matches with the same scoreline
      keys = lambda ss: list(ordered(*s) for s in ss)
      
      # check a sequence of scores, all different and in ordered pairs
      check = lambda ss, ps: len(set(ss)) == len(ss) and all(x > y for (x, y) in chunk(ps, 2))
      
      # margin
      margin = lambda ss: ss[0] - ss[1]
      
      # record scores in the S vs I matches
      rs = multiset()
      
      # scorelines for E (who have won all their matches)
      (ew1, ew2, es1, es2, ei1, ei2) = mes = 'w' * 6
      for ssE in football.scores(mes, [0] * 6, 16, 3):
        # check scorelines
        ss0 = keys(ssE)
        if not check(ss0, ss0): continue
      
        # E wins E vs W by same margin, same as exactly one of the E vs I
        (EW1, EW2, ES1, ES2, EI1, EI2) = ssE
        d = margin(EW1)
        if not (d == margin(EW2) and (margin(EI1), margin(EI2)).count(d) == 1): continue
      
        # W have 2 draws and 2 losses remaining
        for mws in subsets("ddll", size=len, select="mP"):
          for ssW in football.scores(mws, [0] * 4, 8, 15, [EW1, EW2], [1, 1]):
            ss1 = keys(ssW)
            if not check(ss0 + ss1, ss1): continue
      
            # calculate current goals for/against S and I (so far)
            (WS1, WS2, WI1, WI2) = ssW
            (fS, aS) = football.goals([ES1, ES2, WS1, WS2], [1, 1, 1, 1])
            (fI, aI) = football.goals([EI1, EI2, WI1, WI2], [1, 1, 1, 1])
            # goals against S and I sum to 20 (and goals for S and I sum to 14)
            (ga, gf) = (20 - aS - aI, 14 - fS - fI)
            if ga < 0 or gf < 0: continue
      
            # choose outcomes for S vs I matches
            (ws1, ws2, wi1, wi2) = mws
            for (si1, si2) in football.games(repeat=2):
              S = football.table([es1, es2, ws1, ws2, si1, si2], [1, 1, 1, 1, 0, 0])
              I = football.table([ei1, ei2, wi1, wi2, si1, si2], [1, 1, 1, 1, 1, 1])
              if not (12 >= S.points >= I.points >= 2): continue
      
              # chose remaining "for" and "against" goals for S
              for (x, y) in product(irange(0, gf), irange(0, ga)):
                # look for scorelines
                for (SI1, SI2) in football.scores([si1, si2], [0, 0], x, y):
                  ss2 = keys([SI1, SI2])
                  if not check(ss0 + ss1 + ss2, ss2): continue
                  # and check goals "for"/"against" I
                  (x_, y_) = football.goals([SI1, SI2], [1, 1])
                  if not (x + x_ == gf and y + y_ == ga): continue
                  # check S is second and I is third
                  if not (S.points > I.points or fS - aS + x - y > fI - aI + x_ - y_): continue
                  if not (I.points > 2 or fI - aI + x_ - y_ > -7): continue
                  printf("[EW = {EW1} {EW2}; ES = {ES1} {ES2}; EI = {EI1} {EI2}; WS = {WS1} {WS2}; WI = {WI1} {WI2}; SI = {SI1} {SI2}]")
                  rs.add((SI1, SI2))
      
      # output solution
      for (k, v) in rs.most_common():
        printf("S vs I = {k} [{v} solutions]", k=join(k, sep=", "))
      

      Solution: The scores in the Scotland vs. Ireland matches were 4-0 and 0-0.

      There are many scenarios which lead to this solution. One of them is:

      E vs W = 3-2, 2-1
      E vs S = 3-0, 2-0
      E vs I = 5-0, 1-0
      W vs S = 2-2, 1-3
      W vs I = 1-4, 1-1
      S vs I = 4-0, 0-0

      Like

    • John Crabtree's avatar

      John Crabtree 4:28 pm on 16 April 2021 Permalink | Reply

      There were 38 goals scored, ie the minimum possible, and so the match scores were 0-0; 1-0; 2-0, 1-1; 3-0, 2-1; 4-0, 3-1, 2-2; 5-0, 4-1, 3-2.
      Wales scored 8 goals, with scores of 2-3 vE, 1-2 vE, 1-1, 2-2, 1-3 and 1-4.
      And so the scores in England’s other games were 1-0 vI, 2-0, 3-0 and 5-0.
      The other two matches were between Ireland and Scotland with scores of 0-0 and 4-0.

      It is interesting to know when these puzzles started. Some of the later ones were much more convoluted

      Like

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Design a site like this with WordPress.com
Get started