public static void Main(string[] args) { Config config = new Config(); SearchParameters searchParams = new SearchParameters(); searchParams.SetMoveTime(30000); SearchEngine searchEngine = new SearchEngine(config); searchEngine.GetBoard().SetFen("rq2r1k1/5pp1/p7/4bNP1/1p2P2P/5Q2/PP4K1/5R1R w - -"); searchEngine.Go(searchParams); }
public ExperimentalEvaluator(Config config) { this.config = config; }
public CompleteEvaluator(Config config) { // Bonus by having two bishops // Bishops // Mobility units: this value is added for each destination square not occupied by one of our pieces // Bishops // Rooks // No pawns in rook column // Only opposite pawns in rook column // Rook connects with other rook TODO??? // Queen // Protection: sums for each pawn near king (opening) // King Safety: not in endgame!!! // Pawns // Penalty for each pawn in a doubled rank // private final static int PAWN_BACKWARD = oe(-8,-10); // private final static int PAWN_BLOCKED = oe(0,0); //-20; // Pawn blocked by opposite pawn // Weak pawn // Depends of the rank // Depends of the rank // Sums by each square away of the other opposite king // Ponder kings attacks by the number of attackers (not pawns) later divided by 8 // two or more pieces of the other side attacked by inferior pieces // Tempo // Add to moving side score // The pair of values are {opening, endgame} // Values are rotated for whites, so when white is playing is like shown in the code this.config = config; }
public SearchEngine(Config config) { // time to think to // For testing suites // Inital Ply of search // For performance Benching // aspiration window // Futility pruning // Aggresive Futility pruning // Razoring // Singular Extension // Null Move // Transposition Table this.config = config; random = new Random(); board = new Board(); sortInfo = new SortInfo(); moveIterators = new MoveIterator[MAX_DEPTH]; for (int i = 0; i < MAX_DEPTH; i++) { moveIterators[i] = new MoveIterator(board, sortInfo, i); } pvReductionMatrix = new int[][] { new int[64], new int[64], new int[64], new int[ 64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int [64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int [64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64] }; nonPvReductionMatrix = new int[][] { new int[64], new int[64], new int[64], new int [64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int [64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64], new int [64], new int[64], new int[64], new int[64], new int[64], new int[64], new int[64 ], new int[64], new int[64], new int[64], new int[64] }; // Init our reduction lookup tables for (int depth = 1; depth < MAX_DEPTH; depth++) { // OnePly = 1 for (int moveNumber = 1; moveNumber < 64; moveNumber++) { double pvRed = 0.5 + Math.Log(depth) * Math.Log(moveNumber) / 6.0; double nonPVRed = 0.5 + Math.Log(depth) * Math.Log(moveNumber) / 3.0; pvReductionMatrix[depth][moveNumber] = (int)(pvRed >= 1.0 ? Math.Floor(pvRed * PLY ) : 0); nonPvReductionMatrix[depth][moveNumber] = (int)(nonPVRed >= 1.0 ? Math.Floor(nonPVRed * PLY) : 0); } } // System.out.println(i + " " + j + " " + // pvReductionMatrix[i][j] + " " + nonPvReductionMatrix[i][j]); Init(); }
public virtual void SetConfig(Config config) { this.config = config; }
public virtual void Destroy() { config = null; observer = null; tt = null; evaluator = null; sortInfo = null; if (moveIterators != null) { for (int i = 0; i < MAX_DEPTH; i++) { moveIterators[i] = null; } } System.GC.Collect(); }