The codebase is written in C# and utilizes Windows Forms for the user interface.
Main Features
-
Chess Gameplay: The game follows the standard rules of Chess, including movement, capturing, and checking.
-
Multiplayer: Two players can play against each other over a network connection. One player can act as the server, and the other player can act as the client.
-
Chat Feature: Players can send and receive messages to/from each other using the in-game chat feature. The chat messages are displayed in the chat history box.
-
Timers: Each player has a timer that counts down during their turn. If a player does not make a move within the time limit, they lose the game.
-
Game State Tracking: The game tracks the state of the Chessboard, including capturing pieces, checking, and checkmate situations.
-
Visual Indicators: The game includes visual indicators for check and checkmate situations.
-
Audio support: The game includes audio indicators to add to the immersiveness of the game.
How to Play
-
Run the application on two different computers or in two different instances to simulate a network connection between two players.
-
One player should select "join" and the other player should select "host" and the other player should
-
The game will establish a network connection, and the players can now play Chess.
-
Use the mouse to select and move Chess pieces according to the standard Chess rules.
-
Use the in-game chat feature to communicate with the opponent during the game.
-
The game will automatically track game state and check for checkmate situations.
-
Enjoy the Chess game with your opponent and try to checkmate them!
Using The Codebase
To use the codebase, follow these steps:
-
Clone the repository to your local machine using the following command: git clone https://github.com/Strahinja2112/chess-engine.git
-
Open the solution file ('Chess_Engine.sln') in your preferred C# IDE (e.g., Visual Studio).
-
Build the solution to restore dependencies and compile the code.
-
Run the project to start the chess game.
Code Structure
The codebase is structured as follows:
- 'Chess_Engine.Forms.MainForm': The main entry point of the application, representing the chess game form. Next two components are sub-classes of 'MainForm':
- 'Chess_Engine.Forms.SingleplayerForm': A form representing the single-player mode of the game.
- 'Chess_Engine.Forms.MultiplayerForm': A form representing the multiplayer mode of the game.
- 'Chess_Engine.Forms.PromotionForm': A form to handle pawn promotion when a pawn reaches the opposite end of the board.
- 'Chess_Engine.Forms.ClientForm': A form representing the client side in a TCP-based multiplayer game.
- 'Chess_Engine.Forms.ServerForm': A form representing the server side in a TCP-based multiplayer game.
- 'Chess_Engine.Controls.Tile': Represents a single tile on the chessboard, responsible for rendering and handling user interactions.
- 'Chess_Engine.Classses.Board': Contains logic related to the chessboard, including move validation, detecting checkmate, and managing the game state.
- 'Chess_Engine.Classses.ChessPiece': Represents a chess piece and its properties, such as color, type, points, and possible moves.
- 'Chess_Engine.Classses.ChessBot': A static class that provides a chess bot implementation for making evaluated moves in the game.
- 'Chess_Engine.Classses.ScreenScaling': A static class that enables screen scaling for compatibility across different resolutions.
Game Modes
The codebase supports the following game modes:
- Player vs. Player (PvP): Allows two human players to play against each other on the same device.
- Player vs. Bot (PvB): Enables a human player to play against a computer-controlled bot.
- Bot vs. Bot (BvB): Allows two computer-controlled bots to play against each other.
Future Enhancements
While the current codebase provides the fundamental functionality of a chess game, there are plans to expand and add more features in the future. Some potential future enhancements include:
- Implementing additional chess rules and game variations (e.g., en passant, stalemate).
- Adding support for saving and loading game state.
- Enhancing the user interface with more visually appealing graphics and animations.
- Introducing additional UI features such as tooltips, hints, and game statistics.
Feel free to fork the repository, experiment with new features, and contribute to the project. Your creativity and contributions are welcomed!
Credits
This Chess Engine codebase was created by Strahinja.
License
This codebase is licensed under the MIT License.