All checks were successful
Fixes critical bug where moves with captures would crash the game.
Root Cause:
- Board.movePiece() returns an object: { captured: pieceOrNull }
- GameController.executeMove() was treating the return value as the piece itself
- This caused move.captured to be { captured: piece } instead of piece
- When GameState.recordMove() tried to access move.captured.color, it was undefined
- Error: "TypeError: undefined is not an object (evaluating 'this.capturedPieces[move.captured.color].push')"
The Fix:
Extract the captured piece from the return object:
const moveResult = this.board.movePiece(fromRow, fromCol, toRow, toCol);
captured = moveResult.captured;
This ensures move.captured is the actual Piece object (or null), not wrapped in an object.
Impact:
- Moves with captures now work correctly
- Captured pieces are properly tracked in game state
- UI can now display captured pieces
- Game flow works end-to-end
Testing:
- All 124 unit tests passing ✅
- Captures properly recorded in capturedPieces arrays
- No regression in non-capture moves
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>