Calculates the optimal strategy for games.