Overview
A Java Swing application that solves the calculator game with dynamic programming, plays it against you with perfect-play hints and a live decision tree, and benchmarks a family of solver strategies.
Two players take turns adding a digit to a running total, and which digits are legal depends on where the last one sat on the keypad. Whoever reaches 31 or goes past it loses. The game is finite, deterministic and fully observable, so optimal play is not a matter of judgement: the value of a position follows from the values of the positions it leads to, and the solver can name the winner from any state on the board.
Because every position is solved, the interactive mode can show the perfect move while you play, and the benchmark can compare solver strategies knowing they all agree on the answer.
Project 5 of 7 for the Advanced Algorithms course at the Universitat de les Illes Balears, the one on dynamic programming.
javadynamic-programminggame-theory