diff --git a/DroidFish/src/org/petero/droidfish/engine/DroidComputerPlayer.java b/DroidFish/src/org/petero/droidfish/engine/DroidComputerPlayer.java index 137b4a9..0c90e0b 100644 --- a/DroidFish/src/org/petero/droidfish/engine/DroidComputerPlayer.java +++ b/DroidFish/src/org/petero/droidfish/engine/DroidComputerPlayer.java @@ -332,12 +332,13 @@ public class DroidComputerPlayer { /** Decide what moves to search. Filters out non-optimal moves if tablebases are used. */ private final ArrayList movesToSearch(SearchRequest sr) { ArrayList moves = null; + ArrayList legalMoves = new MoveGen().legalMoves(sr.currPos); if (engineOptions.rootProbe) - moves = Probe.getInstance().findOptimal(sr.currPos); + moves = Probe.getInstance().removeNonOptimal(sr.currPos, legalMoves); if (moves != null) { sr.searchMoves = moves; } else { - moves = new MoveGen().legalMoves(sr.currPos); + moves = legalMoves; sr.searchMoves = null; } return moves; diff --git a/DroidFish/src/org/petero/droidfish/gtb/Probe.java b/DroidFish/src/org/petero/droidfish/gtb/Probe.java index cada149..059229d 100644 --- a/DroidFish/src/org/petero/droidfish/gtb/Probe.java +++ b/DroidFish/src/org/petero/droidfish/gtb/Probe.java @@ -177,10 +177,9 @@ public class Probe { return ret; } - /** Return a list of all legal moves that are not known to be non-optimal. + /** Return a list of all moves in moveList that are not known to be non-optimal. * Returns null if no legal move could be excluded. */ - public final ArrayList findOptimal(Position pos) { - ArrayList moveList = new MoveGen().legalMoves(pos); + public final ArrayList removeNonOptimal(Position pos, ArrayList moveList) { ArrayList optimalMoves = new ArrayList(); ArrayList unknownMoves = new ArrayList(); final int MATE0 = 100000;