Fixed AI bug related to endgame behavior