This program looks for the best solution of the MathDice game:
To play, you generate a "Target Number" (by rolling dice) and three "Scoring Numbers" (by rolling three more dice). The goal is to form a math equation out of your three Scoring Numbers that gets as close to the target as possible. If you're playing competitively, the player with the closest score wins a point. If you're playing cooperatively, you work with your teammates to find an equation that gets you closest to the target number.
To the program, we need to add an output saying which set of operations got the best answer. We could systematize the generation of the permutations of the three dice. We think we have all of the possible expressions and have protected against all of the invalid operations, but let us know if we messed up.
If you have any suggestions or comments please contact Mickey Segal. A listing of many Java resources is at this link.