# Enigmatic Code

Programming Enigma Puzzles

## Enigma 384: Hang it!

From New Scientist #1533, 6th November 1986 [link]

Our local club’s darts’ champion Rice Robswit was about to throw three darts in an attempt to win the match. The score he needed could have been got with one treble, but in order to show his prowess and to finish with a double he went for a single, a treble of a different number, and a double of a different number again (avoiding the bulls) in order to give him exactly the total he wanted. Being an experienced player he did not actually look at the numbers around the board — he simply threw the three darts into exactly the positions he had planned.

The crowd roared their approval until someone pointed out that, after the board had fallen on the floor at the end of the previous player’s throw, it had been hung up upside down. There was a groan from the crowd until, on a fresh and proper count, it was found that Rice had still scored his correct required total.

What was that total?

(The numbers around a darts board are in the order 20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5, 20, …).

[enigma384]

### 2 responses to “Enigma 384: Hang it!”

1. Jim Randell 17 February 2017 at 8:54 am

This Python program runs in 43ms.

```
from itertools import permutations
from enigma import irange, printf

# the numbers on a normal dartboard
normal = (20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5)

# rotate (circular shift) right
def ror(s, n=1):
return s[-n:] + s[:-n]

# the numbers on an inverted dartboard
invert = ror(normal, 10)

# consider the positions of the single, double and treble
for (i, j, k) in permutations(irange(0, 19), 3):

# find the score on a normal board
x = normal[i] + 2 * normal[j] + 3 * normal[k]

# it should be the same as on an inverted board
if not(x == invert[i] + 2 * invert[j] + 3 * invert[k]): continue

# the score could have been achieved with a single treble
(d, r) = divmod(x, 3)
if not(r == 0 and 0 < d < 21): continue

printf("score = {x} = {s} + 2x {d} + 3x {t}", s=normal[i], d=normal[j], t=normal[k])
```

Solution: The total was 54.

The total can be made as:

54 = 6 + 2× 12 + 3× 8

or:

54 = 11 + 2× 2 + 3× 13

where (6, 11), (12, 2) and (8, 13) are diametrically opposite scores.

Of course we don’t know whether he want for (single 6, treble 8, double 12) and accidentally got (single 11, treble 13, double 2) or vice versa. I would tend to think you would aim to finish on the double 12, so that if you missed and got a single 12 on your next go you could try for a double 6 (and if you missed that and got a single 6 you could then try for double 3).

2. Brian Gladman 17 February 2017 at 8:29 pm
```from itertools import permutations

# dartboard numbers clockwise around the board - dart values
# on the 1st row map to values on the 2nd row on the upside
# down board (and vice versa)
db = (20,  1, 18,  4, 13,  6, 10, 15,  2, 17,
3, 19,  7, 16,  8, 11, 14,  9, 12,  5)

# convert a score to a score on the upside down board
f = lambda x : db[(db.index(x) + 10) % 20]

# the single dart and double darts
for s, d in permutations(range(1, 21), 2):
# they must add to a triple score because, with
# a triple score, the total must be a triple
q, r = divmod(s + 2 * d, 3)
if not r:
# the triple dart (different to the other two)
for t in range(1, 21 - q):
if t not in (s, d):
# the score with the three darts
score = s + 2 * d + 3 * t
# find the scores with an upside down dartboard
ss, dd, tt = f(s), f(d), f(t)
# the score with these values is the same
if ss + 2 * dd + 3 * tt == score:
print(score, (s, d, t), (ss, dd, tt))
```

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