A full chess engine implementation with a C++ backend for game logic and a C# frontend for board visualization and user interaction. The engine supports standard movement rules, turn handling, captures, checks, and checkmates, and communicates with the UI through a custom pipe protocol.
The backend handles all game logic:
- Board representation
- Movement validation for all pieces
- Capture handling
- Turn-based gameplay
- Check and checkmate detection
- Move execution and board updates
The frontend (chessGraphics.exe) displays the board, highlights moves, and sends player actions to the backend.
Note: Pawn promotion, castling, and en passant are not implemented.
- Full piece movement rules
- Turn management
- Legal/illegal move detection
- Capture logic
- Check & checkmate detection
- Console-hidden backend with pipe communication
- C# graphical board display
- Complete playable chess match
- Castling
- Pawn promotion
- En passant
- Stalemate/draw detection
The engine includes classes for every chess piece:
KingQueenRookBishopKnightPawn
Along with:
Board– manages the 8×8 boardPipe– handles communication between backend and frontend
The backend launches the UI automatically and waits for it to connect:
system("start ./chessGraphics.exe");
Pipe p;
p.connect();Moves are received from the UI as 4-character strings (e.g., "e2e4"), processed, validated, and the engine responds with result codes.
The C# graphical application (chessGraphics.exe) displays:
- The board
- All pieces
- User-selected moves
- Move result feedback (illegal, check, etc.)
It sends moves to the backend via Pipe, receives updates, and redraws the board accordingly.
The engine sends and receives messages using the Pipe class.
- Move commands (e.g.,
"e2e4") "quit"to exit
- Initial board layout string
- Move result codes:
| Code | Meaning |
|---|---|
| 0 | Valid move |
| 1 | Valid move + CHECK |
| 2 | No piece at source square |
| 3 | Illegal move |
| 6 | This piece cannot move |
| 8 | Game over (king captured) |
Compile the C++ source files using Visual Studio or another compiler:
g++ main.cpp -o ChessEngine.exeEnsure all .cpp and .h files are included.
ChessEngine/
├── ChessEngine.exe
└── chessGraphics.exe
ChessEngine.exe
The frontend will open automatically and start the game.
- Implement castling
- Implement pawn promotion
- Implement en passant
- Add stalemate/draw detection
- Add AI (minimax + evaluation)
- Add move history and notation