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](https://private-user-images.githubusercontent.com/86296165/307226303-816b77cb-29f5-4a74-b951-650edec91a9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwOTYzNjcsIm5iZiI6MTcyNDA5NjA2NywicGF0aCI6Ii84NjI5NjE2NS8zMDcyMjYzMDMtODE2Yjc3Y2ItMjlmNS00YTc0LWI5NTEtNjUwZWRlYzkxYTllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDE5MzQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwMTdjN2ExMTZkMjVlMmU4MjljMjVjNzk1NDExMTYzMDI2MGRhODBjNjkzMzUxZjAzODVlMzQ5NzgwM2E2ZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8soHZZXnROmoNK6cYyOQV_jjeY1SgOMMLj90rMXLYGQ)
![Screenshot 2024-02-22 at 11 41 35 PM](https://private-user-images.githubusercontent.com/86296165/307226339-dc72623f-3679-4939-bce9-151f3c883056.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwOTYzNjcsIm5iZiI6MTcyNDA5NjA2NywicGF0aCI6Ii84NjI5NjE2NS8zMDcyMjYzMzktZGM3MjYyM2YtMzY3OS00OTM5LWJjZTktMTUxZjNjODgzMDU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDE5MzQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNjNzk1NTgzOWJiNDU0NTI4MTFjZDVmMzMwZDZjZTc0YzhhYjEyNDFjOTBjOTNiZmRiNTQ4NDIxMWVhZGY4YWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9ze4NBMIzGeg3m1sGQEBWvE92PRPQb9Ck0FA3joDv0s)
- 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](https://private-user-images.githubusercontent.com/86296165/307226327-94b6bece-6df4-4b90-9f18-41f8af0b09c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwOTYzNjcsIm5iZiI6MTcyNDA5NjA2NywicGF0aCI6Ii84NjI5NjE2NS8zMDcyMjYzMjctOTRiNmJlY2UtNmRmNC00YjkwLTlmMTgtNDFmOGFmMGIwOWM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDE5MzQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRhNjRkMDU1ZWVkY2FlZjczYjllN2JiOTI0ODQ0OThjYjZhNDE4OGQzYmY0MWU4MzZhOGE1NmIzNjA2ZGQ5OTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mrv81OsLn5Dqf4gUe23iCZr-Ny1xab6YQLpla_6iRtc)
![Screenshot 2024-02-22 at 11 32 46 PM](https://private-user-images.githubusercontent.com/86296165/307226347-1c3ab166-9a61-4363-af99-ecd824c06141.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwOTYzNjcsIm5iZiI6MTcyNDA5NjA2NywicGF0aCI6Ii84NjI5NjE2NS8zMDcyMjYzNDctMWMzYWIxNjYtOWE2MS00MzYzLWFmOTktZWNkODI0YzA2MTQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDE5MzQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyOTIzY2FiMTk3OWJkOTVhNDAwN2FmMmMxZmE3N2FhYWZjNmM1MTZhYTYwMDIwYjQ3ODU2MWNjNGYxOTkwNTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.E_ecFSKq6nEKojYNNccXlQostTE7DxaqZlcSThSQbmA)
![Screenshot 2024-02-22 at 11 47 09 PM](https://private-user-images.githubusercontent.com/86296165/307226318-de4f4a7a-747b-47c7-9c2c-2c810ce1be8f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwOTYzNjcsIm5iZiI6MTcyNDA5NjA2NywicGF0aCI6Ii84NjI5NjE2NS8zMDcyMjYzMTgtZGU0ZjRhN2EtNzQ3Yi00N2M3LTljMmMtMmM4MTBjZTFiZThmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDE5MzQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjYmI4OWNjMjhmY2M3NmFiNDdiN2I3MDdkYThlOGM5NzJlOTVhNmQxNjgyZGI1NmNjZDA0Mzg5NWQ0ZjhlN2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GQ2eEHrbc31iluyTD8n7k_UEboLX3Kltz-2c_wNkZJw)
- 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.
by Jai Joshi
23rd February, 2024