While browsing around I saw a mini Python challenge to build a program that can find all solutions to the game "Total Is Right". The game has the following basic rules:
- Pick a bunch of numbers in the set:
- Pick a goal in the range:
- Using each number once and operators +-*/, find a formula that results in the goal.
- Only integer results and sub-results are valid.
(3/2) * 6 is invalid because 3/2 is not an integer result.
For example: Suppose we have the numbers: 3,4,6,7 with a goal of 156. A valid result would be: 4*(3*(6+7)) = 156. Each number is only used once, and the result correctly equals our goal.