One part of the way I managed to often stop oscillating was the random search limit based on these declaration. You may wish to try similar? static final int SEARCH_LIMIT1[] = { 7, 9, 11 }; // 11, 12/13??, 15 works static final int SEARCH_LIMIT2[] = { 9, 11, 13}; // was 13 static final int SEARCH_LIMIT3[] = {11, 13, 15}; // ... then before your minimal search.. i = NumberofPieces(COMPUTER, HUMAN); if (i