
Chess + Advanced AI
Full-featured chess client written in Java, including an advanced AI opponent
In my freshman year CS 2 class, we were tasked with creating a chess client in Java with Swing for the UI. I enjoyed the process so much that I continued to work on it past the requirements and implemented advanced rules such as en passant and castling.
We were also tasked to create a basic AI opponent (just avoid getting captured and prioritize capturing), however I implemented a minimax algorithm with alpha-beta pruning and a heuristic evaluation function that considers position, material, and looks ahead several moves.
I also implemented QoL features such as move highlighting, undo/redo, an evaluation bar, and levels of AI difficulty (depth of lookahead).
Features
- Full chess rules including en passant, castling, and promotion
- Minimax AI opponent with alpha-beta pruning and heuristic evaluation function
- Move highlighting and legal move indication
- Undo/redo functionality
- Evaluation bar showing advantage
- Adjustable AI difficulty levels
Next Steps
I would like to eventually port this to a web application using JavaScript and HTML5 Canvas or WebGL for the UI. This would allow for easier access and possible online multiplayer functionality? I would also enjoy training an AI opponent using my own games, though that may help my opponents train against me 😂.
Links
Open-source on GitHub here