From c5fa2ebf21eea205252d740f2ef4101d43ae945c Mon Sep 17 00:00:00 2001 From: "Phu Minh (Catto)" <53084840+nguyenphuminh@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:42:25 +0700 Subject: [PATCH] Add delta pruning (#15) Add delta pruning based on futility pruning --- README.md | 1 + catto.config.js | 2 +- package.json | 2 +- src/core.ts | 9 +++++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3d99238..15ad624 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Note that the config file is compiled with the engine itself, so if you are usin * Transposition table. * Null-move pruning. * Futility pruning. +* Delta pruning. * Late move reductions. * Search extensions: * Check extensions. diff --git a/catto.config.js b/catto.config.js index 35e0818..90c86f8 100644 --- a/catto.config.js +++ b/catto.config.js @@ -1,6 +1,6 @@ module.exports = { // Current version to show in UCI - version: "v0.8.0", + version: "v0.8.1", // Late move reduction config lmrFullDepth: 4, // Number of moves to be searched in full depth lmrMaxReduction: 3, // Only apply LMR above this depth diff --git a/package.json b/package.json index 26fb321..f9bbb0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "catto", - "version": "0.8.0", + "version": "0.8.1", "description": "The Catto chess engine", "main": "index.js", "scripts": { diff --git a/src/core.ts b/src/core.ts index f950e0f..1c51d02 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1,8 +1,7 @@ import { Chess, Move } from "chess.js"; import { evaluateBoard } from "./evaluate"; -import { mvv_lva, PIECE_NUM } from "./evaluations"; +import { mvv_lva, PIECE_NUM, mgMaterial } from "./evaluations"; import { genZobristKey } from "./zobrist"; -import { mgMaterial } from "./evaluations"; export enum HashFlag { exact, @@ -189,6 +188,12 @@ export class Engine { return beta; } + // Delta pruning + const delta = mgMaterial[4]; + if (evaluation < alpha - delta) { + return alpha; + } + // Found a better move if (evaluation > alpha) { alpha = evaluation;