Skip to content

New Scientist Enigma 597 – Break-Uprithmetic

by Brian Gladman on December 30, 2020

by Susan Denham

From New Scientist #1751, 12th January 1991

In snooker there are 15 red balls worth one point each. If a player pots a red it stays in the hole and he (or she) is allowed to try to pot one of the colours yellow, green, brown, blue, pink or black (worth 2-7 points in that order). If a colour is potted it is brought out again and the player can try for another red, and so on. This continues until all the reds have gone. Then the remaining six colours are potted in ascending order.

The total points achieved in one such run is called a “break”. For example:

red + pink + red + black + red

would be a break of 16.

Having completed the break, the player sits down and lets the other player try for a red and continue the break, and so on. At the end the winning player is the one with the higher grand total of points. A player may choose not to pot the final black if the result is already determined without it. No other rules concern today’s story.

Stephens and Hendry play a frame of snooker. Stephens starts with a break of 3, Hendry follows with a break of 4, Stephens with a break of 5, and so on, and this pattern continues to the end. As usual in quality snooker, the black was potted more times than the yellow, and the pink was potted more times that the blue.

How many times did Stephens pot the brown? And how many times did Hendry pot the brown?

From → Uncategorized

3 Comments Leave one →
  1. Brian Gladman permalink

    I had problems finding the solution for this one because I missed the possibility that the last break involving reds could end in two non-reds, the last being a yellow.

    This runs in 220 milliseconds. Although this is much faster than Jim Randell’s original version, I like the elegance of Jim’s version so I have produced another version following his approach:

    NOTE: This code originally had a bug which has now been corrected (see Jim’s comment below).

    Using profile based timing and CPython version 3.9 with Jim’s multiset implementation, this now gives a run-time of 1.9 seconds, which compares with 2.05 seconds for Jim’s original version. Switching to the Pypi multiset implementation reduces the run-time to 1.1 seconds, a significant performance gain.

  2. @Brian: I think your second program doesn’t generate all viable sequences, which might explain the run time. For example it doesn’t seem to allow breaks where the same colour is potted more than once. When I corrected this I found that the program was slower than my code.

    I have since adapted my original program into a faster version that can also be used to solve Enigma 598 [ ]. It solves this puzzle in 240ms.

    The adapted version is available here [ ].

    • Brian Gladman permalink

      @Jim, Thanks for looking into this. You are right that my code was not a correct implementation of your version and when this is corrected as above the run-times become close to identical when used with your multiset implementation (as I would expect). Switching to the Pypi multiset implementations (see lines 2 and 3) does, however, give a very significant speed gain, although not enough to get anywhere near the speed of my earlier version or your revised implementation.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS