Playground – Countdown Calculator
An attempt to create a solver for the numbers round from the Countdown TV show.
The numbers round explained
Taken from https://en.wikipedia.org/wiki/Countdown_(game_show)
The contestant in control chooses six of 24 shuffled face-down number tiles, arranged into two groups: 20 “small numbers” (two each of 1 through 10), and four “large numbers” of 25, 50, 75, and 100. Some special episodes replace the large numbers with 12, 37, 62, and 87. The contestant decides how many large numbers are to be used, from none to all four, after which the six tiles are randomly drawn and placed on the board. A random three-digit target number is then generated by an electronic machine, known as “CECIL” (which stands for Countdown’s Electronic Calculator In Leeds).
The contestants have 30 seconds to work out a sequence of calculations with the numbers whose final result is as close to the target number as possible. They may use only the four basic operations of addition, subtraction, multiplication and division, and do not have to use all six numbers. A number may not be used more times than it appears on the board. Division can only be performed if the result has no remainder (i.e., the divisor is a factor of the dividend). Fractions are not allowed, and only positive integers may be obtained as a result at any stage of the calculation.
Only the contestant whose result is closer to the target number scores points: 10 for reaching it exactly, 7 for being 1–5 away, 5 for being 6–10 away. Contestants score no points for being more than 10 away, if their calculations are flawed, or if they take too long to give a solution after saying they have not written it down. Both score if they reach the same result, or if their results are the same distance away. Should neither contestant reach the target exactly, the assistant is called upon to attempt a solution, either immediately or at a later time during the episode.