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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃攳 Add Internal Iterative Reduction (IIR) #507

Merged
merged 11 commits into from
Nov 20, 2023
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ If you're a Linux user and are new to .NET ecosystem, the conversation in [this

- PEXT Bitboards [[1](https://www.chessprogramming.org/BMI2#PEXTBitboards)] [[2](https://analog-hors.github.io/site/magic-bitboards/)]

- Internal Iterative Deepening [[1](https://www.chessprogramming.org/Internal_Iterative_Deepening)]

## Credits

Lynx development would simply not have been possible without:
Expand Down
2 changes: 2 additions & 0 deletions src/Lynx.Cli/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"Razoring_Depth1Bonus": 125,
"Razoring_NotDepth1Bonus": 175,

"IIR_MinDepth": 4,

"History_MaxMoveValue": 8192,

// Evaluation
Expand Down
2 changes: 2 additions & 0 deletions src/Lynx/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public sealed class EngineSettings

public int Razoring_NotDepth1Bonus { get; set; } = 175;

public int IIR_MinDepth { get; set; } = 4;

public int History_MaxMoveValue { get; set; } = 8_192;

#region Evaluation
Expand Down
10 changes: 10 additions & 0 deletions src/Lynx/Search/NegaMax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ private int NegaMax(int depth, int ply, int alpha, int beta, bool parentWasNullM
{
return ttEvaluation;
}

// Internal iterative reduction (IIR)
// If this position isn't found in TT, it has never been searched before,
// so the search will be potentially expensive.
// Therefore, we search with reduced depth for now, expecting to record a TT move
// which we'll be able to use later for the full depth search
if (ttElementType == default && depth >= Configuration.EngineSettings.IIR_MinDepth)
{
--depth;
}
}

// Before any time-consuming operations
Expand Down