Skip to content

Comments

feat: Add visual check indicator when king is in check (#80)#81

Open
walshb421 wants to merge 8 commits intomainfrom
visual-checking
Open

feat: Add visual check indicator when king is in check (#80)#81
walshb421 wants to merge 8 commits intomainfrom
visual-checking

Conversation

@walshb421
Copy link
Owner

@walshb421 walshb421 commented Jan 23, 2026

Summary

This PR implements issue #80 - Visual indication when a king is in check.

When a king is in check, the square containing the king is now highlighted with:

  • A red semi-transparent background
  • A pulsing red glow animation for better visibility

Changes Made

Frontend Changes

  1. src/composables/chess.js

    • Added inCheck reactive ref to track check state
    • Parse in_check field from WebSocket game state updates
    • Export inCheck for use in components
  2. src/components/Board.vue

    • Added isKingInCheck(square) helper function that checks if a square contains a king that is currently in check
    • Added conditional in-check class binding to board squares
  3. src/assets/main.css

    • Added .board-square.in-check class with red highlight styling
    • Added @keyframes pulse-check animation for a subtle pulsing effect

Test Plan

  1. Start the chess game with two players
  2. Make moves to put a king in check (e.g., move queen to attack the king)
  3. Verify the king's square turns red with a pulsing glow
  4. Make a move to escape check (move king, block, or capture attacker)
  5. Verify the red highlight disappears

Test Positions (using Debug Panel)

  • Load "White in Check" fixture - white king should be highlighted
  • Load "Fool's Mate" fixture - white king should be highlighted (checkmate position)

Dependencies

Screenshots

The king's square will display with:

  • background-color: rgba(255, 0, 0, 0.6)
  • Pulsing box-shadow animation

Closes #80

MCP Agent added 7 commits January 11, 2026 01:28
Add engine/fixtures.py with predefined chess positions for testing:
- Basic positions (starting, empty)
- Checkmate scenarios
- Special moves (en passant, castling)
- Check scenarios
- Pawn promotion positions
- Stalemate and endgame positions
- Add load_fen() method to parse FEN strings and set board state
- Add to_fen() method to export current position as FEN
- Add WebSocket callbacks for load_fen, load_fixture, get_fixtures
- Track en_passant_target for FEN compatibility
- Include turn and FEN in game state JSON
- Update en passant logic to work with FEN-loaded positions
- Convert indentation from tabs to spaces
- Add loadFen() to load arbitrary FEN positions
- Add loadFixture() to load named test fixtures
- Add getFixtures() to request fixture list from server
- Add reactive refs for turn, currentFen, and fixtures
- Update data watcher to handle new state fields
- Display current game state (turn, player, move number)
- Show current FEN with copy-to-clipboard button
- FEN input field to load arbitrary positions
- Dropdown with categorized test fixtures
- Reset board button
- Dark theme styling to match app
- Add DebugPanel component with toggle visibility
- Press D key to show/hide debug panel
- Add sidebar layout for debug panel
- Ignore keypress when typing in input fields
Comment on lines 29 to 33
if(parsedData.turn \!== undefined) turn.value = parsedData.turn;
if(parsedData.fen) currentFen.value = parsedData.fen;
if(parsedData.fixtures) fixtures.value = parsedData.fixtures;
if(parsedData.in_check \!== undefined) inCheck.value = parsedData.in_check;
})
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a syntax error, and does not run (Probably the escape character)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indicate when a king is in check

1 participant