How s-14chess-p/senior-project-chessai works
Main components
• Frontend: This includes all the static files (HTML, JavaScript, CSS in wwwroot) and the Razor Views (located in the Views folder). These render the game interface, rules, and game result pages.
• Backend – ASP.NET Core:
• Controllers: e.g., HomeController.cs which orchestrates the flow of the application.
• SignalR Hub: ChessHub.cs for real-time multiplayer communication.
• Models: The core business logic representing game entities such as Board, Game, Piece, and the dynamic AI logic found under Models/AIs (with classes like AIFactory, MiniMaxAI, RandyRandom, and SmartyAI).
• Program and Startup configuration: Responsible for app startup, configuration (e.g., appsettings.json), and dependency injection.
• Dynamic AI Integration: The module that allows chess AI models to be added dynamically by placing new files in the designated directory. This is critical and should be highlighted as a plug-in architecture.
Relationships and Data Flow
• Client Side (Web browser) interacts with the backend by:
• Requesting web pages rendered by Razor views.
• Initiating game commands (for moves or lobby creation) through HTTP requests (via the controllers).
• Communicating in real-time with the server via SignalR (handled by ChessHub).
• Controller Layer: Receives and processes user requests, it then manipulates models (i.e., game state, AI moves) and renders responses via views.
• SignalR Component: Acts as the gateway for real-time data; it receives moves/updates and broadcasts game state changes back to connected clients.
• AI Module: The AIFactory and individual AI model classes (e.g., MiniMaxAI) dynamically provide chess engine logic. They are integrated into the game’s flow when a user selects PvAI mode.
Architectural Patterns & Design Principles
• MVC Pattern: The separation of concerns is clear with controllers handling incoming request routing, models holding business logic/data, and views presenting the interface.
• Real-time Communication: The use of SignalR enforces a layered communication approach for dynamic and responsive gameplay.
• Plug-in Architecture for AIs: This allows extension and easy replacement of chess AI models without modifying the core game logic.
Technologies and Frameworks to Highlight
• ASP.NET Core (C#) for the server-side application.
• SignalR for real-time multiplayer interactions.
• Razor Views for dynamic HTML content.
• JavaScript and CSS (with Bootstrap and jQuery libraries) for frontend interactivity.