Skip to content

Commit

Permalink
Add history component to RFP
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 5, 2025
1 parent dc145ea commit 4481947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Lynx/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public int Threads
[SPSA<int>(1, 300, 15)]
public int RFP_DepthScalingFactor { get; set; } = 52;

[SPSA<int>(200, 600, 20)]
public int RFP_HistoryDivisor { get; set; } = 400;

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

Expand Down
4 changes: 3 additions & 1 deletion src/Lynx/Search/NegaMax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ private int NegaMax(int depth, int ply, int alpha, int beta, bool cutnode, Cance
var improvingFactor = improvingRate * (0.75 * depth);

var rfpThreshold = rfpMargin + improvingFactor;
var previousMove = Game.ReadMoveFromStack(ply - 1);
var previousMoveHistory = _quietHistory[previousMove.Piece()][previousMove.TargetSquare()];

if (staticEval - rfpThreshold >= beta)
if (staticEval - rfpThreshold >= beta + previousMoveHistory / Configuration.EngineSettings.RFP_HistoryDivisor)
{
#pragma warning disable S3949 // Calculations should not overflow - value is being set at the beginning of the else if (!pvNode)
return (staticEval + beta) / 2;
Expand Down

0 comments on commit 4481947

Please sign in to comment.