Chanakya — Chess in VS Code
Play chess right inside VS Code against the bundled Chanakya
engine, or plug in any UCI engine you like.
Fully local: no server, no API keys, no network calls.
Features
- Built-in engine. Chanakya ships with the extension, so you can play right after installing.
- Bring your own engine. Add any UCI engine (Stockfish, Komodo, your own) from Settings → Engines. White and Black can use different engines.
- Opening books. Polyglot
.bin books, with a default book included. You can add your own and pick a book for each side. Book moves are marked on the board.
- Bot vs. you, or bot vs. bot. Turn on the bot for either color independently. Set the thinking time per side, and watch live depth, nodes, time and mate-in stats.
- Board. Move by drag-and-drop or by clicking. Legal-move hints, check highlighting, a promotion picker, board flip, several board themes, and sound effects.
- Move history. Branch from any point, navigate with the keyboard, and auto-replay a game.
- Import and export. Load a FEN or PGN (paste it or upload a file). Copy the FEN/PGN or download the game as a
.pgn file.
- Sidebar. The Chanakya activity-bar view can start a new game, load a FEN/PGN, and browse your saved games. Finished games are saved automatically.
Getting started
- Install the extension from the VS Code Marketplace.
- Open the Command Palette (
Ctrl+Shift+P) and run Chess: Open Chess Board. You can also click the Chanakya icon in the activity bar.
- Click the bot toggle on a player panel to have the engine play that color.
Keyboard shortcuts
| Key |
Action |
← / → |
Previous / next move |
↑ / ↓ |
Jump to start / latest move |
Ctrl+Shift+E |
Open the export (FEN/PGN) dialog |
Esc |
Close dialogs |
Using your own engine or book
- Engine. Go to Settings (gear icon) → Engines → Add UCI Engine and pick the executable. The extension first checks that it speaks UCI, then copies it into its own storage, so moving or deleting the original file later is fine.
- Book. Go to Settings → Books → Add Book and pick a Polyglot
.bin file. Choose None for a side if you want the engine to think from move one.
- If you'd rather not copy the engine, set
chanakya.enginePath to its absolute path instead. This replaces the built-in engine.
Extension settings
| Setting |
Description |
Default |
chanakya.enginePath |
Absolute path to a UCI engine that replaces the built-in one |
"" (bundled engine/chanakya.exe) |
chanakya.defaultMovetimeMs |
Engine thinking time per move (ms) when none is chosen |
1000 |
chanakya.defaultDepth |
Fixed search depth; 0 uses move time instead |
0 |
chanakya.maxEngineInstances |
Engine processes kept warm (2 = White and Black bots think independently) |
2 |
Requirements
- Windows x64 for the bundled engine. On macOS or Linux, add a native UCI engine for your OS (see above).
- The bundled engine needs a CPU with AVX2/BMI2 (most Intel CPUs from 2013 onward and AMD Ryzen). On older or low-end CPUs such as some Pentium/Celeron models, the extension shows an "unsupported CPU" error. In that case, add an engine build made for older CPUs.
Troubleshooting
The opening is played, but the engine never moves after it.
Book moves come from the opening book and don't need the engine. Once the game leaves the book, the engine executable has to start. If it can't, VS Code shows a Chanakya: error notification explaining why. Common causes:
- Engine executable not found. Check
chanakya.enginePath, or reinstall the extension.
- Windows refused to start the engine. Antivirus, SmartScreen or a company policy blocked the
.exe. Ask IT to allow it, or unblock it from the file's Properties dialog.
- CPU does not support AVX2/BMI2. See Requirements.
Privacy
The extension makes no network requests. Engines run as local processes and talk to the extension over stdin/stdout. Saved games are kept in VS Code's local extension storage.
About the engine
Chanakya is an open-source chess engine written in C++ by Abhijeet Singh Rajput. Its source code, features and strength benchmarks are at github.com/abhijeetSinghRajput/chanakya.
Feedback
Found a bug or have an idea? Open an issue.
License
MIT. See LICENSE.
| |