This commit is contained in:
2024-10-31 18:40:12 -05:00
parent a507212551
commit 09587b2f4d
6 changed files with 44 additions and 22 deletions

View File

@@ -91,6 +91,11 @@ public sealed class ShogiBoard(BoardState initialState)
public MoveResult Move(WhichPiece pieceInHand, string to)
{
if (BoardState.IsCheckmate)
{
return new MoveResult(false, "The game is over. A winner has been decided.");
}
var index = BoardState.ActivePlayerHand.FindIndex(p => p.WhichPiece == pieceInHand);
if (index == -1)
{
@@ -250,7 +255,8 @@ public sealed class ShogiBoard(BoardState initialState)
list.Add(position);
position += path.Step;
}
} else if (position.IsInsideBoardBoundary())
}
else if (position.IsInsideBoardBoundary())
{
list.Add(position);
}