bug while playing chess #51

Closed
opened 2026-05-04 13:47:03 +00:00 by enjin2310 · 1 comment

White king was captured by bot, game still runs.

White king was captured by bot, game still runs.
Owner

Resolved -- Two fixes:

  1. getPossibleMovesForPiece in chess-game.service.ts was only implemented for pawns, causing check/checkmate detection to fail for all other pieces. Added full move generation for rooks, knights, bishops, queens, and kings with an addLinearMoves helper.
  2. Fixed keyboard event listener leak in chess.component.ts -- bind(this) was creating a new reference each call, preventing removeEventListener from detaching. Stored as stable boundHandleKeyDown reference.

This also resolves #52.

**Resolved** -- Two fixes: 1. `getPossibleMovesForPiece` in `chess-game.service.ts` was only implemented for pawns, causing check/checkmate detection to fail for all other pieces. Added full move generation for rooks, knights, bishops, queens, and kings with an `addLinearMoves` helper. 2. Fixed keyboard event listener leak in `chess.component.ts` -- `bind(this)` was creating a new reference each call, preventing `removeEventListener` from detaching. Stored as stable `boundHandleKeyDown` reference. This also resolves #52.
Sign in to join this conversation.