Skip to content

ecjiang016/ChessnutChess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

179 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

A bitboard based move generator for Chess. Currently at 50 million nps.

Compile by running make in command line.

Usage:

ChessnutChess only supports these UCI commands at this time:

Angle brackets (<>) indicates an argument to be placed there by the user.

Displaying the current board:

d

Loading a fen:

position fen <fen>

Running a perft from the current position:

go perft <depth>

Quitting:

quit

GUI

The GUI is coded in Python with Cython bindings to the C++ move gen.

Prerequisites

NumPy, Pygame, and Cython are needed to run the GUI. Install the packages through command line using:

python3 -m pip install numpy pygame Cython

Compliation

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

Run main.py to play Chess!

Details

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

About

Bitboard Chess move generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors