Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔍 SEE pruning #1077

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Lynx/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ public sealed class EngineSettings
[SPSA<int>(0, 6, 0.5)]
public int SEE_BadCaptureReduction { get; set; } = 2;

[SPSA<int>(1, 10, 0.5)]
public int SEE_Pruning_MaxDepth { get; set; } = 5;

[SPSA<int>(-150, -50, 5)]
public int SEE_Pruning_Noisy_DepthScalingFactor { get; set; } = -99;

[SPSA<int>(-100, 0, 5)]
public int SEE_Pruning_Quiet_DepthScalingFactor { get; set; } = -50;

[SPSA<int>(1, 10, 0.5)]
public int FP_MaxDepth { get; set; } = 7;

Expand Down
18 changes: 18 additions & 0 deletions src/Lynx/Search/NegaMax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,24 @@ private int NegaMax(int depth, int ply, int alpha, int beta, bool parentWasNullM

break;
}

// 🔍 SEE pruning
if (depth <= Configuration.EngineSettings.SEE_Pruning_MaxDepth)
{
var threshold = isCapture
? Configuration.EngineSettings.SEE_Pruning_Noisy_DepthScalingFactor * depth
: Configuration.EngineSettings.SEE_Pruning_Quiet_DepthScalingFactor * depth;

if (!SEE.HasPositiveScore(position, move, threshold))
{
// After making a move
Game.HalfMovesWithoutCaptureOrPawnMove = oldHalfMovesWithoutCaptureOrPawnMove;
Game.RemoveFromPositionHashHistory();
position.UnmakeMove(move, gameState);

continue;
}
}
}

PrefetchTTEntry();
Expand Down
Loading