Skip to content

Conversation

@ezekielelvis
Copy link
Contributor

This pull request significantly updates the chess-game project, enhancing both its features and architecture. The most notable improvements are the addition of a robust online multiplayer mode with real-time chat, a more sophisticated AI opponent, implementation of complete chess rules (including castling, en passant, and check/checkmate detection), and a modularization of the backend codebase. The documentation (README.md) has been thoroughly rewritten to reflect these new capabilities, and a new CheckDetection module is introduced for accurate endgame logic.

Major Feature Additions

  • Added online multiplayer support, including real-time chat, unique game codes for joining/creating games, and session isolation for each player/browser tab. [1] [2] [3]
  • Implemented a complete chess ruleset: full support for castling, en passant, pawn promotion, check, checkmate, and stalemate detection. [1] [2] [3]
  • Enhanced AI opponent with opening book, positional evaluation, tactical awareness, and randomized move selection for varied gameplay. [1] [2]

Backend Architecture and API Improvements

  • Refactored backend into modular services (e.g., ChessApi, ChessGame, ChessAI, CheckDetection, OnlineChessApi, ChatApi, etc.) for maintainability and scalability. [1] [2] [3]
  • Expanded and documented RESTful API endpoints for both single-player and online multiplayer modes, including endpoints for chat and session management.

Technical and Usability Enhancements

  • Improved static file serving and project structure for frontend assets (JS, CSS), and updated static content routing in backend services. [1] [2]
  • Updated database schema and storage logic to support multiple simultaneous games and session isolation.
  • Improved chat message handling and request parameter defaults for better robustness. [1] [2] [3]

These changes make the project a much more complete and realistic chess application, suitable for both solo and competitive online play.

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

…y, and check detection

- Implemented time control management for chess games, allowing for various time settings (bullet, blitz, rapid, classic).
- Added move history tracking to record each move made during the game, including details like captured pieces and check status.
- Introduced check detection service to determine if a king is in check, checkmate, or stalemate.
- Updated piece validation to include castling and en passant rules.
- Enhanced the ChessApi and OnlineChessApi services to support undo functionality and move history retrieval.
- Refactored game state management to accommodate new features, ensuring backward compatibility.
@ezekielelvis
Copy link
Contributor Author

@ggleyzer a new PR and I'm having trouble with the dates @Inject Date date

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR substantially upgrades the chess-game project with full chess rules, online multiplayer (including chat), per-tab single-player sessions, and a more sophisticated AI, plus corresponding UI and backend refactors.

Changes:

  • Frontend: Adds a time-control bar, modernized chat UI, and layout tweaks, including a left-side chat drawer and integration with new backend APIs.
  • Backend: Extends the data model (castling rights, en passant, move history, time control, per-session games), implements full rule enforcement (check/checkmate/stalemate, castling, en passant), and modularizes APIs for single-player, online play, chat, and time control.
  • Documentation: Rewrites README and server module wiring to reflect the new architecture, endpoints, and capabilities.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
chess-game/webapp/public/static/styles.css Adds styling for the new time-control bar, left-side slide panel, and a fully redesigned chat UI to support modern multiplayer UX.
chess-game/webapp/public/static/app.js Integrates per-tab single-player session IDs, wires the frontend to new REST routes, introduces client-side time control handling, improves online state handling, and enhances chat polling/rendering.
chess-game/webapp/public/index.html Adds the visible time-control bar and switches the chat drawer to a left-side slide panel, aligning markup with new UI components.
chess-game/server/chessDB/main/x/chessDB.x Extends the schema with castling rights, move history, time control, half-move clocks, per-session single-player games, and richer online game metadata (including opponent-left tracking).
chess-game/server/chess/main/x/chess/ValidMovesHelper.x Updates valid-move generation to accept castling rights and en passant targets and filters out moves that would leave the king in check.
chess-game/server/chess/main/x/chess/TimeControlService.x Introduces a service for creating and updating TimeControl objects, including common presets, though it is not yet fully integrated into game flow.
chess-game/server/chess/main/x/chess/PieceValidator.x Refactors piece-type helpers, adds en passant support for pawns, and implements castling logic for kings using CastlingRights.
chess-game/server/chess/main/x/chess/OnlineChessLogic.x Propagates new GameRecord fields into OnlineGame, adds opponent-left tracking, and builds richer API state objects for online clients.
chess-game/server/chess/main/x/chess/OnlineChessApi.x Extends online endpoints to support time-control configuration on room creation, respects castling/en passant in valid-moves queries, and marks players as having left games instead of deleting rooms outright.
chess-game/server/chess/main/x/chess/ChessGame.x Centralizes game state updates to include castling rights, en passant, history, and accurate status via CheckDetection, and enriches move notation.
chess-game/server/chess/main/x/chess/ChessApi.x Reworks single-player API to be per-session (browser tab) with separate game storage, and adjusts opponent-move scheduling over per-session pending maps.
chess-game/server/chess/main/x/chess/ChessAI.x Replaces the simple heuristic AI with a materially and positionally aware evaluator, pseudo-randomized among top moves, plus a basic opening book.
chess-game/server/chess/main/x/chess/CheckDetection.x Introduces full check, checkmate, and stalemate detection utilities, including legal-move enumeration that respects castling rights and en passant.
chess-game/server/chess/main/x/chess/ChatApi.x Implements room-scoped chat send/history/recent endpoints, now using a monotonic counter for ordering rather than true timestamps.
chess-game/server/chess/main/x/chess.x Updates top-level module wiring, refines chat request/response contracts, and splits static content routing between root and /static.
chess-game/README.md Thoroughly updates documentation to describe the new architecture, modes, endpoints, AI behavior, session isolation, and (intended) time control support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ezekielelvis and others added 2 commits January 19, 2026 09:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@ggleyzer ggleyzer left a comment

Choose a reason for hiding this comment

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

Please go over all your classes and replace the service with class for functional classes that have no state and only contain static methods

@ggleyzer
Copy link
Contributor

Date is not injectable. You would inject the Clock to get the date/time from it

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.

3 participants