CuckooChess: Implemented late move pruning.

This commit is contained in:
Peter Osterlund 2011-12-04 17:32:22 +00:00
parent c53f582581
commit 7168e4be6e
3 changed files with 12 additions and 4 deletions

View File

@ -30,7 +30,7 @@ public class ComputerPlayer implements Player {
public static final String engineName; public static final String engineName;
static { static {
String name = "CuckooChess 1.13a7"; String name = "CuckooChess 1.13a8";
String m = System.getProperty("sun.arch.data.model"); String m = System.getProperty("sun.arch.data.model");
if ("32".equals(m)) if ("32".equals(m))
name += " 32-bit"; name += " 32-bit";

View File

@ -712,8 +712,16 @@ public class Search {
boolean mayReduce = (m.score < 53) && (!isCapture || m.score < 0) && !isPromotion; boolean mayReduce = (m.score < 53) && (!isCapture || m.score < 0) && !isPromotion;
boolean givesCheck = MoveGen.givesCheck(pos, m); boolean givesCheck = MoveGen.givesCheck(pos, m);
boolean doFutility = false; boolean doFutility = false;
if (futilityPrune && mayReduce && haveLegalMoves) { if (mayReduce && haveLegalMoves && !givesCheck && !passedPawnPush(pos, m)) {
if (!givesCheck && !passedPawnPush(pos, m)) int moveCountLimit;
if (depth <= plyScale) moveCountLimit = 3;
else if (depth <= 2 * plyScale) moveCountLimit = 6;
else if (depth <= 3 * plyScale) moveCountLimit = 12;
else if (depth <= 4 * plyScale) moveCountLimit = 24;
else moveCountLimit = 256;
if (mi >= moveCountLimit)
continue; // Late move pruning
if (futilityPrune)
doFutility = true; doFutility = true;
} }
int score; int score;

View File

@ -177,7 +177,7 @@ public class SearchTest {
pos = TextIO.readFEN("7k/5RR1/8/8/8/8/1q3q2/3K4 w - - 0 1"); pos = TextIO.readFEN("7k/5RR1/8/8/8/8/1q3q2/3K4 w - - 0 1");
sc = new Search(pos, nullHist, 0, tt); sc = new Search(pos, nullHist, 0, tt);
sc.maxTimeMillis = -1; sc.maxTimeMillis = -1;
score = idSearch(sc, 3).score; score = idSearch(sc, 4).score;
assertTrue(score < 0); assertTrue(score < 0);
pos = TextIO.readFEN("7k/5RR1/8/8/8/8/1q3q2/3K4 w - - 0 1"); pos = TextIO.readFEN("7k/5RR1/8/8/8/8/1q3q2/3K4 w - - 0 1");