A bitboard based move generator for Chess. Currently at 50 million nps.
Compile by running make in command line.
ChessnutChess only supports these UCI commands at this time:
Angle brackets (<>) indicates an argument to be placed there by the user.
d
position fen <fen>
go perft <depth>
quit
The GUI is coded in Python with Cython bindings to the C++ move gen.
NumPy, Pygame, and Cython are needed to run the GUI. Install the packages through command line using:
python3 -m pip install numpy pygame Cython
To compile run make cython in command line. If that doesn't work, run python3 GUI/setup.py build_ext instead.
You may need to change the compiler flags in setup.py depending on which compiler Cython decides to use.
If Cython is using g++ or clang, change the contents of setup.py to:
from setuptools import setup, Extension
from Cython.Build import cythonize
setup(ext_modules=cythonize(
Extension(
"chess",
["./GUI/chess.pyx",
"./src/masks.cpp",
"./src/bits.cpp",
"./src/piece.cpp",
"./src/game.cpp"
],
language="c++",
extra_compile_args=["-O3", "std=c++17"],
)
), options={'build_ext':{'build_lib':'./GUI'}})Run main.py to play Chess!
Moves are generated using pre-computed masks generated by a Python script, masks.py.
Sliding piece moves are generated using magic bitboards.
Takes inspiration from nkarve's surge