A UCI compatible chess engine written in C from scratch. Refer to statistics.md for progress and statistics.
Pre-requisites - CMake >= 3.5. A C compiler that supports C17 standard or above. C23 is recommended (Haven't tried with C99).
mkdir build
cd build
cmake ..
make
./tests # Run tests
./munchess # Run engine
Pre-requisites - CMake >= 3.5, Visual Studio (MSVC or Clang-CL (MSVC CLI)).
(I personally use VSCode's CMake extension to configure and generate Visual Studio project. But, will paste the cmake command it executes.)
mkdir build
cd build
cmake.EXE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S.. -B. -G "Visual Studio 17 2022" -T host=x64 -A x64 # Change parameters according to your system
Open chess.sln
in the build
folder using Visual Studio and run either Tests
or Munchess
project by selecting the corresponding project as the startup project (right-click on the project and select Set as Startup Project
).
Follow Tools
> Settings
> Engines
. Press the +
icon. Browse the executable and give a working directory you prefer. Munchess's log files will save to that directory. Make sure the protocol is set to uci
.
Follow Engine
> Load First Engine
. Browse the executable and give a working directory you prefer. Munchess's log files will save to that directory. Make sure the uci
checkbox is ticked.
cd build
echo 'uci\nisready\nposition startpos moves e2e4 d7d5 \ngo\nquit' | ./munchess
cd build\Debug # or build\Release
(echo uci && echo isready && echo position startpos moves e2e4 d7d5 && echo go && echo quit) | .\munchess
Refer to UCI Documentation for more details
Current benchmark results are in the statistics.md. To run benchmarks yourself,
python benchmark.py --help
For example, to compare the latest engine with the latest engine using 10 games,
python benchmark.py latest latest 10
MIT License
This is a project to demonstrate my abilities in C programming language. Some key usages of the language features are, arena allocation, bit fields in structs for compacting memory usage, branch-less programming where the performance is critical, cross-platform programming using pre-processor directives, parsing strings, test-driven programming. I am looking for C Software Engineering positions. Please hire me. Thanks.