Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 2.85 KB

README.md

File metadata and controls

41 lines (32 loc) · 2.85 KB

AI Chess Engine Using MiniMax and Alpha-Beta Pruning

A customizable chess game/engine that allows you to play human vs human, computer vs human and computer vs computer. Chess being a zero-sum game, the computer AI is implemented through the MiniMax algorithm and is enhanced using Alpha-Beta pruning.

I have implemented my own categories for calculating the value at each stage. Thus, the MiniMax algorithm will look at future moves (4 moves if depth is 4) and will judge the future moves based on the categories thereby selecting the optimal move. Despite the large number of possible moves during each chess position, the AI engine has been implemented in such a way using Alpha-Beta pruning that it analyzes the position and plays the optimal move in almost no time.

Screenshot 2024-02-22 at 11 49 18 PM Screenshot 2024-02-22 at 11 41 35 PM

Features

  • AI supported chess engine with customizable depth
  • Customizable board colours and legal move indicating dots
  • Ability to flip the chess board
  • Interactive GUI which shows the captured pieces and the moves in chess notation
  • Customizable chess engine by altering MiniMax properties
  • Readable and simple implementation using OOPs
  • All chess moves implemented including en passant, pawn promotion, stalemate and castling
Screenshot 2024-02-22 at 11 42 58 PM Screenshot 2024-02-22 at 11 32 46 PM Screenshot 2024-02-22 at 11 47 09 PM

Technical Aspects, Usage and Acknowledgement

  • Moves are calculated using the MiniMax algorithm with a customizable depth to check for the best move possible
  • Alpha-Beta pruning is implemented for efficiency and engine optimization
  • Code written in Java on IntelliJ
  • The GUI was implemented through JFrame in the package javax.swing (preinstalled)

To use, just download the code and run the 'Chess' class. There is no need to install anything else. It can be run on any normal device that supports java for human vs human and upto depth 4 for the AI. Beyond that it will use more time and resources.

I worked on this project alone and will not be actively working on the project anymore (I will be creating other related projects). However, I would love any suggestions/feedback/collaborative requests.

Author and Date

by Jai Joshi
23rd February, 2024