Buggy code:
public class GameSearcher implements Runnable , ActivityController , LocalSearchResultConsumer { private static final Logger LOGGER = LogManager . getLogger ( ) ; private static final Logger STATS_LOGGER = LogManager . getLogger ( "stats" ) ; public static final boolean USE_DYNAMIC_SAMPLE_SIZING = true ; private static final boolean DISABLE_NODE_TRIMMING = MachineSpecificConfiguration . getCfgBool ( CfgItem . DISABLE_NODE_TRIMMING ) ; private static final long MIN_LOCAL_SEARCH_REFRESH_PERIOD = 1000 ; private static final long LOCAL_SEARCH_REVIEW_PLAYED_MOVE_TIME = 3000 ; public static final long SAMPLE_SIZE_UPDATE_INTERVAL_MS = 10000 ; private static final long STATS_LOG_INTERVAL_MS = 1000 ; private static final int PIPELINE_SIZE = 24 ; private static final boolean ADJUST_EXPLORATION_BIAS_FROM_TREE_SHAPE = false ; public static int thinkBelowPlanSize = 0 ; private volatile long moveTime ; private volatile long startTime ; private volatile int searchSeqRequested = 0 ; private volatile int searchSeqProcessing = 0 ; private volatile boolean requestYield = false ; private MCTSTree [ ] factorTrees ; private GamePlan mPlan = null ; private final Pool < TreeNode > mNodePool ; private final Pool < TreeEdge > mEdgePool ; private final UncappedPool < TreePath > mPathPool ; private final Pool < RAVEStats > mRAVEStatsPool ; private final ScoreVectorPool mScoreVectorPool ; private RolloutProcessorPool rolloutPool = null ; private double minExplorationBias = 0.5 ; private double maxExplorationBias = 1.2 ; private volatile boolean mTerminateRequested = false ; private RuntimeGameCharacteristics mGameCharacteristics ; private Pipeline mPipeline ; private long mLastNumIterations = 0 ; private long mNumIterations = 0 ; private int mRootDepth = 0 ; private boolean mSuppressSampleSizeUpdate = false ; private int mMaxIterationsPerTurn = - 1 ; public boolean mUseRAVE = false ; public boolean mUseGoalGreedy = false ; private OpenBitSet mPlayoutTrace = null ; private final String mLogName ; private final SampleAverageMean mAverageFringeDepth = new SampleAverageMean ( ) ; private final SampleAverageRMS mRMSFringeDepth = new SampleAverageRMS ( ) ; private Move mChosenMove ; public final SampleAverage mAverageBranchingFactor = new SampleAverageMean ( ) ; private RolloutPerfStats mLastRolloutPerfStats = new RolloutPerfStats ( 0 , 0 ) ; public long longestObservedLatency = 0 ; public long averageLatency = 0 ; private long numCompletedRollouts = 0 ; private double currentExplorationBias ; private long localSearchRefreshTime ; private int rootDepthAtLastLocalSearchStart = 0 ; private MoveConsequenceSearcher moveConsequenceSearcher = null ; private ForwardDeadReckonInternalMachineState localSearchRoot = null ; private ForwardDeadReckonLegalMoveInfo priorityLocalSearchSeed = null ; private LocalSearchResults searchResultsBuffer = new LocalSearchResults ( ) ; private volatile int lastProcessedSearchResultSeq = 0 ; private int lastQueuedSearchResultSeq = 0 ; private int localSearchResultProcessingAttemptSeq = 0 ; private static final int LOCAL_SEARCH_WIN_PROCESSING_MAX_RETRIES = 100 ; private long mSelectTime ; private long mExpandTime ; private long mGetSlotTime ; private long mRolloutTime ; private long mBackPropTime ; private int mLastAllocations = 0 ; private int mLastTranspositions = 0 ; StateInfo mStateInfoBuffer ; public GameSearcher ( int nodeTableSize , int numRoles , String xiLogName ) { } public void setExplorationBiasRange ( double min , double max ) { } public void setup ( ForwardDeadReckonPropnetStateMachine underlyingStateMachine , ForwardDeadReckonInternalMachineState initialState , RoleOrdering roleOrdering , RuntimeGameCharacteristics gameCharacteristics , boolean disableGreedyRollouts , Heuristic heuristic , GamePlan plan , ForwardDeadReckonPropositionInfo [ ] roleControlProps ) { } @ Override public void run ( ) { } public boolean isComplete ( ) { if ( ( ( mMaxIterationsPerTurn ) != ( - 1 ) ) && ( ( getNumIterations ( ) ) >= ( mMaxIterationsPerTurn ) ) ) { return true ; } <START_BUG> if ( ! ( mPlan . isEmpty ( ) ) ) { <END_BUG> return true ; } for ( MCTSTree tree : factorTrees ) { if ( ! ( tree . mRoot . mComplete ) ) { return false ; } } return true ; } private void logStats ( long xiTime ) { } public TreeEdge getPrimaryPath ( ForwardDeadReckonInternalMachineState resultingState ) { } public Move getBestMove ( ) { } public boolean expandSearch ( boolean forceSynchronous ) throws GoalDefinitionException , MoveDefinitionException , TransitionDefinitionException { } public int getNumIterations ( ) { } public int getNumRollouts ( ) { } private boolean searchAvailable ( ) throws InterruptedException { } public Pipeline getPipeline ( ) { } public void startSearch ( long moveTimeout , ForwardDeadReckonInternalMachineState startState , short rootDepth , ForwardDeadReckonLegalMoveInfo lastMove ) { } public void chooseMove ( Move xiMove ) { } @ Override public void requestYield ( boolean state ) { } @ Override public Object getSerializationObject ( ) { } public long processCompletedRollout ( RolloutRequest lRequest ) { } long processCompletedRollouts ( boolean xiNeedToDoOne ) throws GoalDefinitionException , MoveDefinitionException , TransitionDefinitionException { } void recordIterationTimings ( long xiSelectTime , long xiExpandTime , long xiGetSlotTime , long xiRolloutTime , long xiBackPropTime ) { } public GamePlan getPlan ( ) { } private void updateSampleSize ( ) { } public void terminate ( ) { } public int getRootDepth ( ) { } private void setRootDepth ( int xiRootDepth ) { } @ Override public void ProcessLocalSearchResult ( LocalSearchResults xiResults ) { } private void ProcessQueuedLocalSearchResults ( ) { } No newline ; at end ; of file ; }

Fix:
if ( ( mPlan . size ( ) ) > ( GameSearcher . thinkBelowPlanSize ) ) {