Skip to content

Commit

Permalink
Single killer move
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Nov 29, 2023
1 parent 22183f9 commit 1a5e024
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/Lynx/Search/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ internal int ScoreMove(Move move, int depth, bool useKillerAndPositionMoves, Mov
return EvaluationConstants.FirstKillerMoveValue;
}

if (_killerMoves[1, depth] == move)
{
return EvaluationConstants.SecondKillerMoveValue;
}

if (_killerMoves[2, depth] == move)
{
return EvaluationConstants.ThirdKillerMoveValue;
}

// History move or 0 if not found
return EvaluationConstants.BaseMoveScore + _historyMoves[move.Piece(), move.TargetSquare()];
}
Expand Down
6 changes: 2 additions & 4 deletions src/Lynx/Search/IDDFS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class Engine
{
private readonly Stopwatch _stopWatch = new();
private readonly Move[] _pVTable = new Move[Configuration.EngineSettings.MaxDepth * (Configuration.EngineSettings.MaxDepth + 1) / 2];
private readonly int[,] _killerMoves = new int[3, Configuration.EngineSettings.MaxDepth];
private readonly int[,] _killerMoves = new int[1, Configuration.EngineSettings.MaxDepth];
private readonly int[,] _historyMoves = new int[12, 64];
private readonly int[] _maxDepthReached = new int[Constants.AbsoluteMaxDepth];
private TranspositionTable _tt = Array.Empty<TranspositionTableElement>();
Expand All @@ -21,7 +21,7 @@ public sealed partial class Engine
private bool _isScoringPV;

private SearchResult? _previousSearchResult;
private readonly int[,] _previousKillerMoves = new int[3, Configuration.EngineSettings.MaxDepth];
private readonly int[,] _previousKillerMoves = new int[1, Configuration.EngineSettings.MaxDepth];

private readonly Move _defaultMove = default;

Expand Down Expand Up @@ -264,8 +264,6 @@ private int CheckPonderHit(ref SearchResult? lastSearchResult, int depth)
for (int d = 0; d < Configuration.EngineSettings.MaxDepth - 2; ++d)
{
_killerMoves[0, d] = _previousKillerMoves[0, d + 2];
_killerMoves[1, d] = _previousKillerMoves[1, d + 2];
_killerMoves[2, d] = _previousKillerMoves[2, d + 2];
}

// Re-search from depth 1
Expand Down
2 changes: 0 additions & 2 deletions src/Lynx/Search/NegaMax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ private int NegaMax(int depth, int ply, int alpha, int beta, bool parentWasNullM
// 🔍 Killer moves
if (!move.IsCapture() && move.PromotedPiece() == default && move != _killerMoves[0, ply])
{
_killerMoves[2, ply] = _killerMoves[1, ply];
_killerMoves[1, ply] = _killerMoves[0, ply];
_killerMoves[0, ply] = move;
}

Expand Down

0 comments on commit 1a5e024

Please sign in to comment.