sunfish
Sunfish: a Python Chess Engine in 111 lines of code
What is sunfish?
Sunfish: a Python Chess Engine in 111 lines of code
Overview of sunfish
What it is
Sunfish is a simple but strong chess engine written in Python. The core engine, with its UCI interface and after removing comments and whitespace, takes up 126 lines of code. There is also a stronger NNUE-based version that is only 4096 bytes for the whole engine. The name Sunfish refers to the Pygmy Sunfish, and the project is inspired by engines such as Stockfish, Zappa, and Rybka, while borrowing much from Micro-Max by Geert Muller and PyChess.
Key features
- Built around the simple but efficient MTD-bi search algorithm, also known as C*.
- Filled with classic chess engine tricks for simpler and faster code.
- Efficiently updatable evaluation function through Piece Square Tables.
- Uses standard Python collections and data structures for clarity and efficiency.
- Supports all chess rules except the 50-move draw rule.
- Can be packed into a single self-extracting executable of about 3kb.
Use cases
Sunfish is designed as a platform for experimenting with chess engine development. People have used it for testing parallel search algorithms, experimenting with evaluation functions, and developing deep learning chess programs. It can be played against via Lichess (both the classic and NNUE versions) or in a terminal. The engine speaks UCI and can be used with GUIs such as Arena, Cute Chess, PyChess, and BanksiaGUI, as well as with command-line tournament tools like fastchess and cutechess-cli.
Getting started
bash$ pip install sunfish$ sunfishOr, from a repo checkout, run sunfish_ui/fancy.py -cmd ./sunfish.py.
License and pricing
The license is not stated in the provided metadata or README.
Based on the project's public README and repository metadata.