Countdown

From Rosetta Code
Revision as of 07:57, 6 October 2022 by Blanvill (talk | contribs) (Draft creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Countdown is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

This is originally a 1972 French television game show. The game consists of randomly selecting six of the twenty-four numbers, from a list of: twenty "small numbers" (two each from 1 to 10), and four "large numbers" of 25, 50, 75 and 100. A random target number between 101 and 999 is generated. The players have 30 seconds to work out a sequence of calculations with the numbers whose final result is as close as possible to the target number. Only the four basic operations: addition, subtraction, multiplication and division can be used to create new numbers and not all six numbers are required. A number can only be used once. Division can only be done if the result has no remainder (fractions are not allowed) and only positive integers can be obtained at any stage of the calculation. (More info on the original game).

The brute force algorithm is quite obvious. What is more interesting are the optimisation heuristics to reduce the number of calculations. For example, a rather interesting computational challenge is to calculate all possible games (with all the 120'867'208 combinations of six numbers out of twenty-four for all possible targets between 101 and 999).