This repository tracks the journey of writing my first chess engine. It's written in C# and contains 3 projects:
- a command-line based GUI (MinimalChessBoard)
- an UCI chess engine (MinimalChessEngine)
- a library implementing chess logic and algorithms used by the other two applications (MinimalChess)
My focus is on creating a minimal chess engine with just enough features and optimizations to become a reasonably strong player.
Version 0.2 of MinimalChess uses iterative deepenging search with alpha-beta pruning and a simple killer-move heuristic and evaluates a position by counting material. That's all. This lack of sophistication causes it to play rather weak at only a little over 1000 ELO. Nothing to brag about but it makes it a good sparring partner for weak human players like myself and chess programmers who are just starting out. (Again - like myself) The engine is open source and I tried to write code that is as simple as possible to both understand and explain. It could be smaller or faster but I doubt it could be much simpler than it currently is. ;)
I have documented each milestone of the development in an accomanying Youtube video.
- Making of MinimalChessEngine - Episode 1: Hello World
- Making of MinimalChessEngine - Episode 2: Let's Play
- Making of MinimalChessEngine - Episode 3: Move Generation
- Making of MinimalChessEngine - Episode 4: Search & Eval
You can find prebuild binaries of different versions of MinimalChess for Mac, Linux and Windows here on github.
To play I recommend you add MinimalChessEngine as an engine to an UCI compatible Chess GUI such as CuteChess.
You can also run MinimalChessBoard to get a console based Chess GUI that allows you to play chess against the engine. I don't recommend it though. This part of the project is mainly used during development for analysis and debugging purposes!
| Command | Description |
|---|---|
| [move] | You can play the game by typing in the move you want to make in the long algebraic notation e.g. "e2e4" to move white's King's Pawn. |
| reset | Reset the board to the start position. |
| fen [fenstring] | Setup the board to represent the given position. |
| perft [depth] | Compute perft values of the given depth |
| divide [depth] | Compute perft values of all available moves |
| ! [depth] | Play the best move, search it with the given depth |
| ? [depth] | List all available moves |
| ?? | Print the resulting board for each available move |
Please let me know of any bugs or stability issues and must-have features you feel even the most barebones engine should support but MinimalChess is lacking. Don't hesitate to contact via email or open an issue or engage in the discussions section of this repository.