dimdano/numbfish: ♟︎ A strong python chess bot running on 1-thread @GitHub
Numbfish is a simple but strong pythonic chess engine. Numbfish is based on Sunfish but with several additional features, the most important of which is an Efficiently Updatable Neural Network (NNUE) implemented and optimized first time using numpy.NNUE is efficiently implemented using incremental updates of the input layer outputs in make and unmake moves just like Stockfish does in C++. The additional positional information entailed from NNUE makes this engine probably the strongest python engine running on 1-thread CPU.
Numbfish keeps a very simple but optimized python interface, taking up just 140 lines of code! (see compressed.py
) Yet it plays at 2300 ratings at Lichess.
Efficiently updatable neural network - Wikipedia
Now even Sunfish.py "evolved" to have NNUE, and that increased number of lines of code to 131.
Sunfish is a simple, but strong chess engine, written in Python. With its simple UCI interface, and removing comments and whitespace, it takes up just 131 lines of code! (build/clean.sh sunfish.py | wc -l). Yet it plays at ratings above 2000 at Lichess.
In contrast to the large NNUE in say, Stockfish, this network is only 1207 bytes! That makes sure sunfish NNUE can still be packed into less than 4KB. Using NNUE, sunfish will play better positionally, but worse tactically, since the implementation is still not fast enough.
to run current version of sunfish.py on Windows computers (i.e. with default PowerShell console) provided commands from GitHub will not work. Those are for unix based systems (Mac, Linux).
This works
This works
python .\tools\fancy.py -cmd "python .\sunfish.py"
The reason is that sunfish.py, like many other chess playing programs is now using "UCI" interface, no embedded UI, and requires a separate UI app, in this case "fancy.py".
here is one all-in-one chess app in python, but much bigger and more complex then above two.
No comments:
Post a Comment