From e1ff2b84bc3f8d213cea4390a1c160e083a0cb07 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Wed, 1 Jan 2025 15:19:47 +0000 Subject: [PATCH] Update dependencies and optimize chess move computation Upgraded various package dependencies in both test and main projects to their latest stable versions. Simplified the chess move computation logic by replacing custom depth handling with a streamlined `go depth` command for improved clarity and maintainability. --- src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj | 12 ++++++------ src/Aiursoft.ChessServer/Services/ChessEngine.cs | 7 +++---- .../Aiursoft.ChessServer.Tests.csproj | 10 +++++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj b/src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj index 4a49666..f400139 100644 --- a/src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj +++ b/src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj @@ -10,12 +10,12 @@ enable - - - - - + + + + + - + \ No newline at end of file diff --git a/src/Aiursoft.ChessServer/Services/ChessEngine.cs b/src/Aiursoft.ChessServer/Services/ChessEngine.cs index 236a360..6d8089d 100644 --- a/src/Aiursoft.ChessServer/Services/ChessEngine.cs +++ b/src/Aiursoft.ChessServer/Services/ChessEngine.cs @@ -39,9 +39,8 @@ public class ChessEngine _engine.AdjustPosition($"position fen {fen}"); var positionClone = new Position(_engine.Game.CurrentPosition); - var depth = difficulty - 1; - var result = _engine.IDDFS(depth, 10); - _engine.Game.ResetCurrentPositionToBeforeSearchState(); - return result.BestMove.ToEPDString(positionClone); + return _engine.BestMove(new($"go depth {difficulty}")) + .BestMove + .ToEPDString(positionClone); } } \ No newline at end of file diff --git a/tests/Aiursoft.ChessServer.Tests/Aiursoft.ChessServer.Tests.csproj b/tests/Aiursoft.ChessServer.Tests/Aiursoft.ChessServer.Tests.csproj index b4fe387..b0b162f 100644 --- a/tests/Aiursoft.ChessServer.Tests/Aiursoft.ChessServer.Tests.csproj +++ b/tests/Aiursoft.ChessServer.Tests/Aiursoft.ChessServer.Tests.csproj @@ -9,15 +9,15 @@ enable - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - - + + +