chore: Update LynxChess.Lynx package reference to LynxChess.Lynx.Internal
This commit is contained in:
@@ -15,6 +15,6 @@
|
||||
<PackageReference Include="Aiursoft.Scanner" Version="8.0.1" />
|
||||
<PackageReference Include="Aiursoft.WebTools" Version="8.0.21" />
|
||||
<PackageReference Include="Gera.Chess" Version="1.1.0" />
|
||||
<PackageReference Include="LynxChess.Lynx" Version="1.5.1" />
|
||||
<PackageReference Include="LynxChess.Lynx.Internal" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Threading.Channels;
|
||||
using Chess;
|
||||
using Lynx;
|
||||
using Lynx.Model;
|
||||
|
||||
@@ -21,13 +20,14 @@ public class ChessEngine
|
||||
|
||||
public string GetBestMove(string fen)
|
||||
{
|
||||
var board = ChessBoard.LoadFromFen(fen);
|
||||
|
||||
_engine.AdjustPosition($"position fen {fen}");
|
||||
var moves = _engine.IDDFS(1, 10);
|
||||
var bestMove = moves.Moves
|
||||
.Select(t => t.ToEPDString())
|
||||
.FirstOrDefault(t => board.IsValidMove(t));
|
||||
return bestMove ?? moves.BestMove.ToEPDString();
|
||||
var positionClone = new Position(_engine.Game.CurrentPosition);
|
||||
|
||||
var result = _engine.IDDFS(1, 10);
|
||||
_engine.Game.ResetCurrentPositionToBeforeSearchState();
|
||||
|
||||
return result
|
||||
.BestMove
|
||||
.ToEPDString(positionClone);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user