Evaluating an Equations Board |
Equations is a game that is played competitively in several parts (The game as described below is only a subset of the actual game). You are to write a program which evaluates an Equations board.
The game equations is played with 13 cubes. Each cube will contain six of
the following symbols, one symbol on each side:
0 1 2 3 4 5 6 7 8 9 + - x
(Each symbol can be found on six of the cubes.) The symbols + ,- and x stand for the binary operations addition, subtraction, and multiplication, respectively.
There are two sections to an Equation board: Resources and Goal. At the
beginning of a game of Equations, all of the cubes are rolled and placed
into Resources section. For all examples below, assume that the following
was rolled:
0 1 4 5 6 7 9 + + + - x x
One of the players then sets a goal by taking one or two of the digits in the Resources section and placing them into the Goal section. (assume that you cannot have a goal with a leading 0 such as 09.) For all the examples below, the goal is 56.
The central idea of the game is to make a solution which equals the goal
and uses a subset of the other cubes. There are two main restrictions to
the solution:
999999+++++ 54 0149++-7+xx 56 0149++-7+-- 56
solution solution no solution