A browser-based chess game where players compete against an AI opponent. The project was built to explore game tree search and decision-making algorithms by implementing a chess engine capable of selecting moves based on future game states.
The AI evaluates possible moves using the minimax algorithm with alpha-beta pruning, allowing it to search ahead while avoiding unnecessary calculations.
- Websitechess-ai-red.vercel.app//
- FrontendReact, HTML, CSS
- BackendJavaScript
- DevOpsVercel
The chess AI uses the minimax algorithm to evaluate potential moves several turns into the future. The algorithm models the game as a series of alternating decisions: the AI attempts to maximise the evaluation of the board, while assuming that the opposing player will make moves that minimise it.
This allows the AI to choose moves based not only on the immediate position, but also on the possible responses that follow. Each candidate move creates additional game states that can be evaluated recursively until the search reaches its stopping condition.
Searching every possible sequence of chess moves quickly becomes computationally expensive. To make minimax practical, the engine uses alpha-beta pruning to eliminate branches of the search tree that cannot affect the final decision.
By keeping track of the best options already found for both players, the algorithm can stop exploring a branch once it is clear that the opponent would never allow that position to occur. This reduces the number of positions that need to be evaluated while preserving the result of the minimax search. The depths of the alpha-beta pruning ranges from 3 to 5.
