The ChessAIThon project (2025-1-ES01-KA220-VET-000354329) is co-funded by the European Union. The views and opinions expressed in this publication are those of the author(s) only and do not necessarily reflect those of the European Union or the Spanish Service for the Internationalisation of Education (SEPIE). Neither the European Union nor the National Agency SEPIE can be held responsible for them.
Table of Contents
For our final project, we won't build Stockfish, but a solver that can solve a specific problem: "Find the move that immediately wins the game."
The Scenario
• Simplified chessboard (8x8 Matrix).
• Situation: The Black King is trapped. A White piece must deliver the final blow.
The Algorithm (The "Brain")
The algorithmic approach is called Brute Force: we will try all legal moves until we find the winning one.
1. Analysis: Find where my pieces are.
2. Generation: List all possible moves for each piece.
3. Simulation (The crucial step):
• Make the move virtually on a copy of the board.
• Check: "Is the Black King in checkmate now?"
• If YES: We found the solution! Return the move.
• If NO: Undo the move (or discard the copy) and try the next one.
Necessary Helper Functions (link to 02_ NecessaryHelperFunctions.pdf)
Function to Check for Checkmate (link to 03_FunctionCheckmate.pdf)
The Complete Solver (link to 04_CompleteSolver.pdf)
Usage Example (link to 05_UsageExample.pdf)