Made small change to ai test loop that removes an occasional inf loop. Wanted functionality is unchanged.