Added check to stop AI on checkmate.