AI improvements and fixed illegal move.