Skip to content

Commit

Permalink
Add delta pruning (#15)
Browse files Browse the repository at this point in the history
Add delta pruning based on futility pruning
  • Loading branch information
nguyenphuminh authored Jul 24, 2024
1 parent e42cfc5 commit c5fa2eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion catto.config.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "catto",
"version": "0.8.0",
"version": "0.8.1",
"description": "The Catto chess engine",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c5fa2eb

Please sign in to comment.