- Select if you want to play an AI or a 2 player game
- Moves can be done by dragging a piece or clicking on a piece and then clicking the new square
- Press R to resset game or D to undo a move
- Toggle AI with A
- Play online at https://mihirdev.com/chess
- Support for castling and auto promotion to queen
- AI by default looks 4 moves into the future
- AI uses minimax with alpha-beta prunning
- Ai uses piece value and piece position to rank moves
- C++ compiler with C++23 support (VS 2022+ or modern gcc/clang recommended)
- Clone the repo
SDL2 is fetched automatically by CMake (no separate install needed).
git clone https://github.com/Mihir-A/Chess-AI.git cd Chess-AI - Build with CMake (recommended):
The binary will be at
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build buildbuild/release/chesson macOS/Linux orbuild\\release\\chess.exeon Windows. - Run the binary, making sure the
assetsfolder is in the same directory.
Use Emscripten to produce a browser build. Outputs go to build/wasm.
- Configure with
emcmake:emcmake cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - Build:
cmake --build build
- Open
build/wasm/chess.htmlin a local web server.
If you previously configured build/ with a native toolchain, clear it before switching:
rm -rf build/CMakeCache.txt build/CMakeFilesMake sure the assets folder sits next to the executable.
If macOS blocks the app (“not opened”), you can:
- Right‑click the
chessbinary → Open → Open. - Or System Settings → Privacy & Security → “chess was blocked” → Open Anyway.
- Or clear quarantine in Terminal:
xattr -d com.apple.quarantine /path/to/chess
Run chess.exe from the build output folder. If SmartScreen warns, choose “More info” → “Run anyway”.
Run the chess binary from the build output folder. If needed, chmod +x chess first.
Distributed under the MIT License. See LICENSE.md for more information.
Project Link: https://github.com/Mihir-A/Chess-AI
- Chess.com Used for Neo pieces
- Chess-AI Used for Piece square tables
- Readme Template


