Add square numbers and bug fixes

This commit is contained in:
jheaps
2025-10-17 12:10:08 -06:00
parent 93bdb3518a
commit 7c77cd0e52
5 changed files with 82 additions and 6 deletions
+2 -2
View File
@@ -165,7 +165,7 @@ public class ChessController(
var expectedPlayerId = isWhiteMove ? gameState.WhitePlayerId : gameState.BlackPlayerId;
if (moveDto.PlayerId != expectedPlayerId)
return Forbid("You are not the current player.");
return StatusCode(403, "You are not the current player.");
// Make sure player owns the piece
var piece = gameState.Pieces.FirstOrDefault(p => p.Id == moveDto.PieceId);
@@ -174,7 +174,7 @@ public class ChessController(
return NotFound("Chess piece Id does not exist");
if ((isWhiteMove && piece.Color != PieceColor.White) || (!isWhiteMove && piece?.Color != PieceColor.Black))
return Forbid("You cannot move this piece.");
return StatusCode(403, "You cannot move this piece.");
var result = chessService.MakeMove(gameState, moveDto);