From 01247a5ecf22741841d7fa88cd23738fd8444cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Sat, 26 Aug 2023 20:16:39 +0200 Subject: [PATCH] Use standard `depth` concept in `NegaMax` method (#377) * Replace custom-made fixed `targetDepth` and increasing `ply` schema, where `ply == targetDepth` was used to trigger QSearch, with the standard, decreasing `depth` by one + reductions, and increasing `ply` by one no-matter-what. * Fix LMR condition, using depth instead of ply * Fix NMP, which was usign ply instead of depth, and get rid of always true condition --- src/Lynx.Dev/Program.cs | 16 +++--- src/Lynx/Engine.cs | 6 +-- src/Lynx/Model/Position.cs | 8 +-- src/Lynx/Model/TranspositionTable.cs | 16 +++--- src/Lynx/Search/Helpers.cs | 6 +-- src/Lynx/Search/IDDFS.cs | 4 +- src/Lynx/Search/NegaMax.cs | 52 +++++++++---------- src/Lynx/UCI/Commands/Engine/InfoCommand.cs | 2 +- tests/Lynx.Test/BestMove/RegressionTest.cs | 2 +- tests/Lynx.Test/BestMove/WACSilver200.cs | 4 +- .../Lynx.Test/Model/TranspositionTableTest.cs | 12 ++--- 11 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Lynx.Dev/Program.cs b/src/Lynx.Dev/Program.cs index 8af6e12c5..30ab003f1 100644 --- a/src/Lynx.Dev/Program.cs +++ b/src/Lynx.Dev/Program.cs @@ -1051,20 +1051,20 @@ static void TesSize(int size) //transpositionTable.RecordHash(position, depth: 3, maxDepth: 5, move: 1234, eval: +5, nodeType: NodeType.Alpha); //var entry = transpositionTable.ProbeHash(position, maxDepth: 5, depth: 3, alpha: 1, beta: 2); - transpositionTable.RecordHash(mask, position, targetDepth: 5, ply: 3, eval: +19, nodeType: NodeType.Alpha, move: 1234); - var entry = transpositionTable.ProbeHash(mask, position, targetDepth: 5, ply: 3, alpha: 20, beta: 30); + transpositionTable.RecordHash(mask, position, depth: 5, ply: 3, eval: +19, nodeType: NodeType.Alpha, move: 1234); + var entry = transpositionTable.ProbeHash(mask, position, depth: 5, ply: 3, alpha: 20, beta: 30); Console.WriteLine(entry); // Expected 20 - transpositionTable.RecordHash(mask, position, targetDepth: 5, ply: 3, eval: +21, nodeType: NodeType.Alpha, move: 1234); - entry = transpositionTable.ProbeHash(mask, position, targetDepth: 5, ply: 3, alpha: 20, beta: 30); + transpositionTable.RecordHash(mask, position, depth: 5, ply: 3, eval: +21, nodeType: NodeType.Alpha, move: 1234); + entry = transpositionTable.ProbeHash(mask, position, depth: 5, ply: 3, alpha: 20, beta: 30); Console.WriteLine(entry); // Expected 12_345_678 - transpositionTable.RecordHash(mask, position, targetDepth: 5, ply: 3, eval: +29, nodeType: NodeType.Beta, move: 1234); - entry = transpositionTable.ProbeHash(mask, position, targetDepth: 5, ply: 3, alpha: 20, beta: 30); + transpositionTable.RecordHash(mask, position, depth: 5, ply: 3, eval: +29, nodeType: NodeType.Beta, move: 1234); + entry = transpositionTable.ProbeHash(mask, position, depth: 5, ply: 3, alpha: 20, beta: 30); Console.WriteLine(entry); // Expected 12_345_678 - transpositionTable.RecordHash(mask, position, targetDepth: 5, ply: 3, eval: +31, nodeType: NodeType.Beta, move: 1234); - entry = transpositionTable.ProbeHash(mask, position, targetDepth: 5, ply: 3, alpha: 20, beta: 30); + transpositionTable.RecordHash(mask, position, depth: 5, ply: 3, eval: +31, nodeType: NodeType.Beta, move: 1234); + entry = transpositionTable.ProbeHash(mask, position, depth: 5, ply: 3, alpha: 20, beta: 30); Console.WriteLine(entry); // Expected 30 } diff --git a/src/Lynx/Engine.cs b/src/Lynx/Engine.cs index fe9b55091..5e22ade46 100644 --- a/src/Lynx/Engine.cs +++ b/src/Lynx/Engine.cs @@ -145,7 +145,7 @@ public async Task BestMove(GoCommand? goCommand) Game.MakeMove(resultToReturn.BestMove); } - AverageDepth += (resultToReturn.TargetDepth - AverageDepth) / Math.Ceiling(0.5 * Game.MoveHistory.Count); + AverageDepth += (resultToReturn.Depth - AverageDepth) / Math.Ceiling(0.5 * Game.MoveHistory.Count); return resultToReturn; } @@ -173,7 +173,7 @@ private async Task SearchBestMove(int minDepth, int? maxDepth, int if (searchResult is not null) { _logger.Info("Search evaluation result - eval: {0}, mate: {1}, depth: {2}, pv: {3}", - searchResult.Evaluation, searchResult.Mate, searchResult.TargetDepth, string.Join(", ", searchResult.Moves.Select(m => m.ToMoveString()))); + searchResult.Evaluation, searchResult.Mate, searchResult.Depth, string.Join(", ", searchResult.Moves.Select(m => m.ToMoveString()))); } if (tbResult is not null) @@ -184,7 +184,7 @@ private async Task SearchBestMove(int minDepth, int? maxDepth, int if (searchResult?.Mate > 0 && searchResult.Mate <= tbResult.Mate && searchResult.Mate + currentHalfMovesWithoutCaptureOrPawnMove < 96) { _logger.Info("Relying on search result mate line due to dtm match and low enough dtz"); - ++searchResult.TargetDepth; + ++searchResult.Depth; tbResult = null; } } diff --git a/src/Lynx/Model/Position.cs b/src/Lynx/Model/Position.cs index 72903c6c0..6d610a838 100644 --- a/src/Lynx/Model/Position.cs +++ b/src/Lynx/Model/Position.cs @@ -708,17 +708,17 @@ public int StaticEvaluation(int movesWithoutCaptureOrPawnMove, CancellationToken /// this method determines if a position is a result of either a loss by Checkmate or a draw by stalemate. /// NegaMax style /// - /// Modulates the output, favouring positions with lower depth left (i.e. Checkmate in less moves) + /// Modulates the output, favouring positions with lower ply (i.e. Checkmate in less moves) /// - /// At least if Position.Side lost (more extreme values when increases) + /// At least if Position.Side lost (more extreme values when increases) /// or 0 if Position.Side was stalemated [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int EvaluateFinalPosition(int depth, bool isInCheck) + public static int EvaluateFinalPosition(int ply, bool isInCheck) { if (isInCheck) { // Checkmate evaluation, but not as bad/shallow as it looks like since we're already searching at a certain depth - return -EvaluationConstants.CheckMateBaseEvaluation + (EvaluationConstants.CheckmateDepthFactor * depth); + return -EvaluationConstants.CheckMateBaseEvaluation + (EvaluationConstants.CheckmateDepthFactor * ply); } else { diff --git a/src/Lynx/Model/TranspositionTable.cs b/src/Lynx/Model/TranspositionTable.cs index 294df5ee2..0f083cc84 100644 --- a/src/Lynx/Model/TranspositionTable.cs +++ b/src/Lynx/Model/TranspositionTable.cs @@ -104,7 +104,7 @@ public static void ClearTranspositionTable(this TranspositionTable transposition /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static (int Evaluation, Move BestMove) ProbeHash(this TranspositionTable tt, int ttMask, Position position, int targetDepth, int ply, int alpha, int beta) + public static (int Evaluation, Move BestMove) ProbeHash(this TranspositionTable tt, int ttMask, Position position, int depth, int ply, int alpha, int beta) { if (!Configuration.EngineSettings.TranspositionTableEnabled) { @@ -120,7 +120,7 @@ public static (int Evaluation, Move BestMove) ProbeHash(this TranspositionTable var eval = EvaluationConstants.NoHashEntry; - if (entry.Depth >= (targetDepth - ply)) + if (entry.Depth >= depth) { // We want to translate the checkmate position relative to the saved node to our root position from which we're searching // If the recorded score is a checkmate in 3 and we are at depth 5, we want to read checkmate in 8 @@ -149,7 +149,7 @@ public static (int Evaluation, Move BestMove) ProbeHash(this TranspositionTable /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void RecordHash(this TranspositionTable tt, int ttMask, Position position, int targetDepth, int ply, int eval, NodeType nodeType, Move? move = 0) + public static void RecordHash(this TranspositionTable tt, int ttMask, Position position, int depth, int ply, int eval, NodeType nodeType, Move? move = 0) { if (!Configuration.EngineSettings.TranspositionTableEnabled) { @@ -169,7 +169,7 @@ public static void RecordHash(this TranspositionTable tt, int ttMask, Position p entry.Key = position.UniqueIdentifier; entry.Score = score; - entry.Depth = targetDepth - ply; + entry.Depth = depth; entry.Move = move ?? 0; entry.Type = nodeType; } @@ -180,14 +180,14 @@ public static void RecordHash(this TranspositionTable tt, int ttMask, Position p /// Logic for when to pass +depth or -depth for the desired effect in https://www.talkchess.com/forum3/viewtopic.php?f=7&t=74411 and https://talkchess.com/forum3/viewtopic.php?p=861852#p861852 /// /// - /// + /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static int RecalculateMateScores(int score, int depth) => score + + internal static int RecalculateMateScores(int score, int ply) => score + score switch { - > EvaluationConstants.PositiveCheckmateDetectionLimit => -EvaluationConstants.CheckmateDepthFactor * depth, - < EvaluationConstants.NegativeCheckmateDetectionLimit => EvaluationConstants.CheckmateDepthFactor * depth, + > EvaluationConstants.PositiveCheckmateDetectionLimit => -EvaluationConstants.CheckmateDepthFactor * ply, + < EvaluationConstants.NegativeCheckmateDetectionLimit => EvaluationConstants.CheckmateDepthFactor * ply, _ => 0 }; diff --git a/src/Lynx/Search/Helpers.cs b/src/Lynx/Search/Helpers.cs index 37e40214d..fbe50fdff 100644 --- a/src/Lynx/Search/Helpers.cs +++ b/src/Lynx/Search/Helpers.cs @@ -9,7 +9,7 @@ public class SearchResult { public Move BestMove { get; init; } public double Evaluation { get; init; } - public int TargetDepth { get; set; } + public int Depth { get; set; } public List Moves { get; init; } public int Alpha { get; init; } public int Beta { get; init; } @@ -31,7 +31,7 @@ public SearchResult(Move bestMove, double evaluation, int targetDepth, List EvaluationConstants.PositiveCheckmateDetectionLimit; diff --git a/src/Lynx/Search/NegaMax.cs b/src/Lynx/Search/NegaMax.cs index bf6bacecb..7cd6856f7 100644 --- a/src/Lynx/Search/NegaMax.cs +++ b/src/Lynx/Search/NegaMax.cs @@ -7,9 +7,8 @@ public sealed partial class Engine /// /// NegaMax algorithm implementation using alpha-beta pruning, quiescence search and Iterative Deepeting Depth-First Search (IDDFS) /// - /// Minimum number of depth (plies), regardless of time constrains - /// - /// Current depth or number of half moves + /// + /// /// /// Best score the Side to move can achieve, assuming best play by the opponent. /// Defaults to the worse possible score for Side to move, Int.MinValue. @@ -21,11 +20,11 @@ public sealed partial class Engine /// Indicates if the search is verifying an ancestors null-move that failed high, or the root node /// Indicates whether the immediate ancestor node was a null move /// - private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, bool isVerifyingNullMoveCutOff, bool ancestorWasNullMove = false) + private int NegaMax(int depth, int ply, int alpha, int beta, bool isVerifyingNullMoveCutOff, bool ancestorWasNullMove = false) { var position = Game.CurrentPosition; - // Prevents runtime failure, in case targetDepth is increased due to check extension + // Prevents runtime failure in case depth is increased due to check extension, since we're using ply when calculating pvTable index, if (ply >= Configuration.EngineSettings.MaxDepth) { _logger.Info("Max depth {0} reached", Configuration.EngineSettings.MaxDepth); @@ -39,12 +38,13 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, var nextPvIndex = PVTable.Indexes[ply + 1]; _pVTable[pvIndex] = _defaultMove; // Nulling the first value before any returns + bool isRoot = ply == 0; bool pvNode = beta - alpha > 1; Move ttBestMove = default; - if (ply > 0) + if (!isRoot) { - var ttProbeResult = _tt.ProbeHash(_ttMask, position, targetDepth, ply, alpha, beta); + var ttProbeResult = _tt.ProbeHash(_ttMask, position, depth, ply, alpha, beta); if (ttProbeResult.Evaluation != EvaluationConstants.NoHashEntry) { return ttProbeResult.Evaluation; @@ -59,9 +59,9 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, if (isInCheck) { - ++targetDepth; + ++depth; } - if (ply >= targetDepth) + if (depth <= 0) { if (MoveGenerator.CanGenerateAtLeastAValidMove(position)) { @@ -69,21 +69,21 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, } var finalPositionEvaluation = Position.EvaluateFinalPosition(ply, isInCheck); - _tt.RecordHash(_ttMask, position, targetDepth, ply, finalPositionEvaluation, NodeType.Exact); + _tt.RecordHash(_ttMask, position, depth, ply, finalPositionEvaluation, NodeType.Exact); return finalPositionEvaluation; } - // 🔍 Null-move pruning + // 🔍 Verified Null-move pruning (NMP) - https://www.researchgate.net/publication/297377298_Verified_Null-Move_Pruning bool isFailHigh = false; // In order to detect zugzwangs - if (ply > Configuration.EngineSettings.NullMovePruning_R + if (depth > Configuration.EngineSettings.NullMovePruning_R && !isInCheck && !ancestorWasNullMove - && (!isVerifyingNullMoveCutOff || ply < targetDepth - 1)) // verify == true and ply == targetDepth -1 -> No null pruning, since verification will not be possible) - // following pv? + /*&& (!isVerifyingNullMoveCutOff || depth > 1)*/) // verify == true and ply == targetDepth -1 -> No null pruning, since verification will not be possible) + // following pv? { var gameState = position.MakeNullMove(); - var evaluation = -NegaMax(minDepth, targetDepth, ply + 1 + Configuration.EngineSettings.NullMovePruning_R, -beta, -beta + 1, isVerifyingNullMoveCutOff, ancestorWasNullMove: true); + var evaluation = -NegaMax(depth - 1 - Configuration.EngineSettings.NullMovePruning_R, ply + 1, -beta, -beta + 1, isVerifyingNullMoveCutOff, ancestorWasNullMove: true); position.UnMakeNullMove(gameState); @@ -91,7 +91,7 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, { if (isVerifyingNullMoveCutOff) { - ++ply; + --depth; isVerifyingNullMoveCutOff = false; isFailHigh = true; } @@ -145,13 +145,13 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, } else if (movesSearched == 0) { - evaluation = -NegaMax(minDepth, targetDepth, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); + evaluation = -NegaMax(depth - 1, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); } else { // 🔍 Late Move Reduction (LMR) if (movesSearched >= Configuration.EngineSettings.LMR_FullDepthMoves - && ply >= Configuration.EngineSettings.LMR_ReductionLimit + && depth >= Configuration.EngineSettings.LMR_ReductionLimit && !pvNode && !isInCheck //&& !newPosition.IsInCheck() @@ -159,7 +159,7 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, && move.PromotedPiece() == default) { // Search with reduced depth - evaluation = -NegaMax(minDepth, targetDepth, ply + 1 + Configuration.EngineSettings.LMR_DepthReduction, -alpha - 1, -alpha, isVerifyingNullMoveCutOff); + evaluation = -NegaMax(depth - 1 - Configuration.EngineSettings.LMR_DepthReduction, ply + 1, -alpha - 1, -alpha, isVerifyingNullMoveCutOff); } else { @@ -177,17 +177,17 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, // https://web.archive.org/web/20071030220825/http://www.brucemo.com/compchess/programming/pvs.htm // Search with full depth but narrowed score bandwidth - evaluation = -NegaMax(minDepth, targetDepth, ply + 1, -alpha - 1, -alpha, isVerifyingNullMoveCutOff); + evaluation = -NegaMax(depth - 1, ply + 1, -alpha - 1, -alpha, isVerifyingNullMoveCutOff); if (evaluation > alpha && evaluation < beta) { // Hipothesis invalidated -> search with full depth and full score bandwidth - evaluation = -NegaMax(minDepth, targetDepth, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); + evaluation = -NegaMax(depth - 1, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); } } else { - evaluation = -NegaMax(minDepth, targetDepth, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); + evaluation = -NegaMax(depth - 1, ply + 1, -beta, -alpha, isVerifyingNullMoveCutOff); } } } @@ -214,7 +214,7 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, _killerMoves[0, ply] = move; } - _tt.RecordHash(_ttMask, position, targetDepth, ply, beta, NodeType.Beta, bestMove); + _tt.RecordHash(_ttMask, position, depth, ply, beta, NodeType.Beta, bestMove); return beta; // TODO return evaluation? } @@ -242,7 +242,7 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, // [Null-move pruning] If there is a fail-high report, but no cutoff was found, the position is a zugzwang and has to be re-searched with the original depth if (isFailHigh && alpha < beta) { - --ply; + ++depth; isFailHigh = false; isVerifyingNullMoveCutOff = true; goto VerifiedNullMovePruning_SearchAgain; @@ -252,11 +252,11 @@ private int NegaMax(int minDepth, int targetDepth, int ply, int alpha, int beta, { var eval = Position.EvaluateFinalPosition(ply, isInCheck); - _tt.RecordHash(_ttMask, position, targetDepth, ply, eval, NodeType.Exact); + _tt.RecordHash(_ttMask, position, depth, ply, eval, NodeType.Exact); return eval; } - _tt.RecordHash(_ttMask, position, targetDepth, ply, alpha, nodeType, bestMove); + _tt.RecordHash(_ttMask, position, depth, ply, alpha, nodeType, bestMove); // Node fails low return alpha; diff --git a/src/Lynx/UCI/Commands/Engine/InfoCommand.cs b/src/Lynx/UCI/Commands/Engine/InfoCommand.cs index 509650b2f..6bd579dc0 100644 --- a/src/Lynx/UCI/Commands/Engine/InfoCommand.cs +++ b/src/Lynx/UCI/Commands/Engine/InfoCommand.cs @@ -79,7 +79,7 @@ public static string SearchResultInfo(SearchResult searchResult) { #pragma warning disable RCS1214 // Unnecessary interpolated string. return Id + - $" depth {searchResult.TargetDepth}" + + $" depth {searchResult.Depth}" + $" seldepth {searchResult.DepthReached}" + $" multipv 1" + $" score {(searchResult.Mate == default ? $"cp {searchResult.Evaluation}" : $"mate {searchResult.Mate}")}" + diff --git a/tests/Lynx.Test/BestMove/RegressionTest.cs b/tests/Lynx.Test/BestMove/RegressionTest.cs index e058546d6..5daa6efdb 100644 --- a/tests/Lynx.Test/BestMove/RegressionTest.cs +++ b/tests/Lynx.Test/BestMove/RegressionTest.cs @@ -283,7 +283,7 @@ public async Task PVTableCrash(string fen) var engine = GetEngine(fen); var bestMove = await engine.BestMove(new GoCommand($"go depth {depthWhenMaxDepthInQuiescenceIsReached}")); - Assert.AreEqual(depthWhenMaxDepthInQuiescenceIsReached, bestMove.TargetDepth); + Assert.AreEqual(depthWhenMaxDepthInQuiescenceIsReached, bestMove.Depth); } [Explicit] diff --git a/tests/Lynx.Test/BestMove/WACSilver200.cs b/tests/Lynx.Test/BestMove/WACSilver200.cs index 3afa2d0cc..9e86979f7 100644 --- a/tests/Lynx.Test/BestMove/WACSilver200.cs +++ b/tests/Lynx.Test/BestMove/WACSilver200.cs @@ -44,7 +44,7 @@ private static async Task VerifyBestMove(string fen, string bestMove, string id, if (bestMoveArray.Length == 1) { var expectedMove = bestMoveArray[0].TrimEnd('+'); - Assert.AreEqual(expectedMove, bestResult.BestMove.ToEPDString(), $"id {id} depth {bestResult.TargetDepth} seldepth {bestResult.TargetDepth} nodes {bestResult.Nodes}"); + Assert.AreEqual(expectedMove, bestResult.BestMove.ToEPDString(), $"id {id} depth {bestResult.Depth} seldepth {bestResult.Depth} nodes {bestResult.Nodes}"); } else if (bestMoveArray.Length == 2) { @@ -53,7 +53,7 @@ private static async Task VerifyBestMove(string fen, string bestMove, string id, bestMoveArray[0].TrimEnd('+') == bestResultGot || bestMoveArray[1].TrimEnd('+') == bestResultGot , $"id {id} Expected {bestMove} but got {bestResultGot} " + - $"depth {bestResult.TargetDepth} seldepth {bestResult.TargetDepth} nodes {bestResult.Nodes}"); + $"depth {bestResult.Depth} seldepth {bestResult.Depth} nodes {bestResult.Nodes}"); } else { diff --git a/tests/Lynx.Test/Model/TranspositionTableTest.cs b/tests/Lynx.Test/Model/TranspositionTableTest.cs index c1331d179..522b321e7 100644 --- a/tests/Lynx.Test/Model/TranspositionTableTest.cs +++ b/tests/Lynx.Test/Model/TranspositionTableTest.cs @@ -86,9 +86,9 @@ public void RecordHash_ProbeHash(int recordedEval, NodeType recordNodeType, int var (mask, length) = TranspositionTableExtensions.CalculateLength(Configuration.EngineSettings.TranspositionTableSize); var transpositionTable = new TranspositionTableElement[length]; - transpositionTable.RecordHash(mask, position, targetDepth: 5, ply: 3, eval: recordedEval, nodeType: recordNodeType, move: 1234); + transpositionTable.RecordHash(mask, position, depth: 5, ply: 3, eval: recordedEval, nodeType: recordNodeType, move: 1234); - Assert.AreEqual(expectedProbeEval, transpositionTable.ProbeHash(mask, position, targetDepth: 5, ply: 3, alpha: probeAlpha, beta: probeBeta).Evaluation); + Assert.AreEqual(expectedProbeEval, transpositionTable.ProbeHash(mask, position, depth: 5, ply: 3, alpha: probeAlpha, beta: probeBeta).Evaluation); } [TestCase(CheckMateBaseEvaluation - 8 * CheckmateDepthFactor)] @@ -100,9 +100,9 @@ public void RecordHash_ProbeHash_CheckmateSameDepth(int recordedEval) var (mask, length) = TranspositionTableExtensions.CalculateLength(Configuration.EngineSettings.TranspositionTableSize); var transpositionTable = new TranspositionTableElement[length]; - transpositionTable.RecordHash(mask, position, targetDepth: 10, ply: sharedDepth, eval: recordedEval, nodeType: NodeType.Exact, move: 1234); + transpositionTable.RecordHash(mask, position, depth: 10, ply: sharedDepth, eval: recordedEval, nodeType: NodeType.Exact, move: 1234); - Assert.AreEqual(recordedEval, transpositionTable.ProbeHash(mask, position, targetDepth: 7, ply: sharedDepth, alpha: 50, beta: 100).Evaluation); + Assert.AreEqual(recordedEval, transpositionTable.ProbeHash(mask, position, depth: 7, ply: sharedDepth, alpha: 50, beta: 100).Evaluation); } [TestCase(CheckMateBaseEvaluation - 8 * CheckmateDepthFactor, 5, 4, CheckMateBaseEvaluation - 7 * CheckmateDepthFactor)] @@ -115,8 +115,8 @@ public void RecordHash_ProbeHash_CheckmateDifferentDepth(int recordedEval, int r var (mask, length) = TranspositionTableExtensions.CalculateLength(Configuration.EngineSettings.TranspositionTableSize); var transpositionTable = new TranspositionTableElement[length]; - transpositionTable.RecordHash(mask, position, targetDepth: 10, ply: recordedDeph, eval: recordedEval, nodeType: NodeType.Exact, move: 1234); + transpositionTable.RecordHash(mask, position, depth: 10, ply: recordedDeph, eval: recordedEval, nodeType: NodeType.Exact, move: 1234); - Assert.AreEqual(expectedProbeEval, transpositionTable.ProbeHash(mask, position, targetDepth: 7, ply: probeDepth, alpha: 50, beta: 100).Evaluation); + Assert.AreEqual(expectedProbeEval, transpositionTable.ProbeHash(mask, position, depth: 7, ply: probeDepth, alpha: 50, beta: 100).Evaluation); } } \ No newline at end of file