This is a playable game of chess implemented using C++ and SFML. It allows you to play chess with basic functionalities, including castling and en passant.
Development of a chess engine has started and will be available soon.
- SFML (Simple and Fast Multimedia Library)
- Ubuntu 24.04 (or any other Linux distribution)
- Download and install SFML from the official website.
- Make sure to set up SFML correctly in your development environment. You can follow the official tutorial for guidance.
-
Clone the repository:
git clone https://github.com/eparly/chess_engine.git cd src -
Compile the project:
cg++ main.cpp board.cpp Piece.cpp -o chessboard -lsfml-graphics -lsfml-window -lsfml-system
-
Run the compiled executable:
./chessboard
-
A window will open displaying the chessboard.
-
Use the mouse to select and move pieces:
- Left-click on a piece to select it.
- Left-click on a valid destination square to move the selected piece.
-
The game will alternate turns between white and black pieces.
-
Boardclass in src/board.h and src/board.cppgenerateLegalMoves(): Generates all legal moves for the current player.initializeBoard(): Initializes the board with pieces using a FEN string.draw(sf::RenderWindow& window): Draws the board and pieces on the window.endTurn(): Ends the current turn and updates legal moves.
-
Piececlass in src/piece.h and src/Piece.cppdraw(sf::RenderWindow& window): Draws the piece on the window.getBoardPosition() const: Returns the position of the piece on the board.
