Check if the game exists before computing the best move.
Code improvements.