Skip to content

Commit ae854c3

Browse files
committed
two small bug fixes
1 parent 1f56a13 commit ae854c3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

MinimalChess/IterativeSearch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public IterativeSearch(Board board, Action<LegalMoves> rootMovesModifier) : this
3131

3232
public void Search(int maxDepth)
3333
{
34-
while (maxDepth > Depth)
34+
while (!GameOver && Depth < maxDepth)
3535
SearchDeeper();
3636
}
3737

MinimalChessEngine/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ private static void UciPosition(string[] tokens)
5959
if (tokens[1] == "startpos")
6060
_engine.SetupPosition(new Board(Board.STARTING_POS_FEN));
6161
else if (tokens[1] == "fen") //rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
62-
_engine.SetupPosition(new Board($"{tokens[2]} {tokens[3]} {tokens[4]} {tokens[5]} {tokens[6]} {tokens[7]}"));
62+
{
63+
string fen = string.Join(' ', tokens, 2, tokens.Length - 2);
64+
_engine.SetupPosition(new Board(fen));
65+
}
6366
else
6467
{
6568
Uci.Log("'position' parameters missing or not understood. Assuming 'startpos'.");

0 commit comments

Comments
 (0)