Updating N and checking timelimit more often. No longer plays random
moves, but plays illegal moves and still crashes after a while.