# Enigmatic Code

Programming Enigma Puzzles

## Tantalizer 413: Sports day

From New Scientist #963, 21st August 1975 [link]

There were three events after tea and the headmaster appointed Mr Prendergast as bookmaker. After some thought, Prendy produced quite a pretty plan. For a £1 stake you specified the three winners in the order of events (javelin, long jump, hurdles). If you were wholly right, you collected £10. If you got two events right you collected £4. If you were right about the javelin only, you collected £2. Otherwise you lost.

But Prendy had reckoned without Captain Grimes and Dr Fagan (the headmaster), who nobbled all entrants except Clutterbuck, Oglivie and Tangent. Grimes then staked £6 on bets of: CTT; TCC; OTT; COC; OTO; CCO. He made a profit of £4.

The headmaster also staked £6 and naturally did a little better, with a profit of £6 from his bets of: CCT; TOT; OTC; TOC; CTO; OCO.

Which boy won each of the events?

Corrections (applied to the text above) were published along with Tantalizer 414 and Tantalizer 416.

This issue of New Scientist also contains an article about a computer program for solving Tantalizer puzzles using natural language [link].

[tantalizer413]

### One response to “Tantalizer 413: Sports day”

1. Jim Randell 22 January 2020 at 12:30 pm

In spite of the multiple corrections to the puzzle text the final puzzle has 2 solutions.

This Python program examines all possible outcomes in 104ms.

Run: [ @repl.it ]

```from enigma import subsets, join, printf

# winings for a bet <b> with result <r>
def winnings(b, r):
# which events were correct?
s = list(i for (i, (x, y)) in enumerate(zip(b, r)) if x == y)
# all 3 correct = win 10
if len(s) == 3: return 10
# 2 correct = win 4
if len(s) == 2: return 4
# just the first event correct = win 2
if 0 in s: return 2
# otherwise: win = 0
return 0

# bets for G and F
G = [ 'CTT', 'TCC', 'OTT', 'COC', 'OTO', 'CCO' ]
F = [ 'CCT', 'TOT', 'OTC', 'TOC', 'CTO', 'OCO' ]

# consider possible results
for r in subsets('COT', size=3, select="M"):
# profits for G and F
(g, f) = (sum(winnings(b, r) for b in X) - len(X) for X in (G, F))
# G has a profit of 4, F has a profit of 6
if not(g == 4 and f == 6): continue

printf("result = {r}", r=join(r, sep=", "))
```

Solution: There are two solutions: C, C, T and O, C, O.

The published answer was the first of these.

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