### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,393)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (61)
- site news (62)
- tantalizer (105)
- teaser (7)
- today (1)

### Site Stats

- 244,211 hits

Programming Enigma Puzzles

8 July 2015

Posted by on **From New Scientist #1441, 31st January 1985** [link]

Yesterday, a red letter day in our local club, was the occasion for the single-frame final of our annual snooker tournament. This climactic “Battle of the Titans” began with much canny safety play — but there were no scores until a stunning table-length red opened the balls to a useful break. The suspense mounted thereafter as successive visits to the table resulted in breaks which totalled just one point more than the (opponent’s) preceding break. I remember that all 15 red balls (scoring one point each) were potted singly, and every red was successfully followed by a nominated coloured ball. No penalty points were incurred and the frame was not ceded prematurely.

Once again, Roland Cannon took the winner’s cup. Rusty Abacus, our referee and official marker, gave a little presentation speech; referring to the recent final, he remarked that all the coloured balls potted in association with red balls had been potted the same number of times as the points value of the particular coloured ball. Then the blue ball (say) would have been potted five times in all.

Roland also won the medal for the highest break of the tournament. This was his reward for a gallant 22-point clearance which snatched the victory in his quarter-final battle.

Note that the potting sequence/points value of the coloured balls is: yellow/2, green/3, brown/4, blue/5, pink/6 and black/7 points. Also, the club rules committee insists that when a player has a lead of eight points or more after the final pink has been potted, then the final black ball must not be played.

What was Roland’s total score in that final frame?

[enigma293]

%d bloggers like this:

The first program I wrote to solve this problem didn’t come up with any answers, so here’s a slower Python 3 program which generates ascending sequences of break scores starting with a score between 3 (the smallest possible break) and 21 (the highest possible break in the final), and then applies the additional tests. It takes 53s to check all possible scores.

Solution:Roland’s total score in the final was 60 points.There are thirteen possible matches (sequences of balls) that correspond to this scenario. All of them involve breaks of 12, 13, 14, 15, 16, 17, 18 (to give total scores of 60 and 45). The final black is not played. The colours potted with the reds are: 1 yellow, 2 greens, 3 browns, 4 blues, 5 pinks. Player 2 pots the final red and then a yellow. Player 1 then pots the green, brown, blue and pink, and takes the frame without needing to pot the black. So overall (including the clearance) each coloured ball is potted its own number of times, with the exception of the black, which is not potted at all.

One example match is:

(1 4 1 6) (1 5 1 6) (1 6 1 6) (1 2 1 4 1 6) (1 3 1 5 1 5) (1 3 1 4 1 5 2) (3 4 5 6)

(I don’t distinguish the order that the balls were potted in, so (1 4 1 6) could be red/brown/red/pink or red/pink/red/brown, without this restriction the program finds 3960 possible sequences).

The next possible match with ascending sequence of break scores is breaks of (19, 20, 21, 22, 23) to give total scores of (63, 42) (again the final black is not played). But such a sequence is not a solution as the highest break in the tournament was 22, and it wasn’t in the final. Nevertheless here is an example sequence for this scenario:

(1 3 1 3 1 4 1 5) (1 5 1 6 1 6) (1 6 1 6 1 6) (1 4 1 4 1 5 1 5) (1 2 2 3 4 5 6)

Here’s a faster program. It runs in 1.65s (using PyPy).