Guitarfish (6.1.45@6.4) is an open-source UCI-compliant chess engine written in Python, featuring a custom 64-bit bitboard move generator accelerated by Numba JIT and an evaluation function powered by a neural network (Custom NNUE).
Guitarfish runs live as an official bot on Lichess: @guitarfish-engine.
- Rapid Rating: ~2100 ELO
- Blitz Rating: ~1900 ELO
- Challenge Policy: Currently configured to accept Blitz and Rapid challenges only.
Note: The engine is self-hosted on a local machine. If the bot is offline or not responding, the server is likely turned off while the author is away at school =)))
The engine is named after the guitarfish (Rhinobatidae), a real family of rays characterized by a flattened body and an elongated snout resembling an acoustic guitar.
- Engine Core: Custom 64-bit bitboard implementation compiled to native machine code using Numba JIT.
- Evaluation: Custom NNUE architecture with 1,729 board features (Piece-Square tables, Combat Maps, King Safety zones, and Pawn Phalanxes/Chains), quantized to INT8 for CPU inference.
- Search Algorithm: Negamax with Principal Variation Search (PVS) and Alpha-Beta pruning.
- Pruning & Reductions:
- Singular Extensions (SE)
- Null Move Pruning (NMP)
- Reverse Futility Pruning (RFP)
- Futility Pruning (FP)
- Late Move Pruning (LMP)
- Dynamic Late Move Reductions (LMR)
- Static Exchange Evaluation (SEE) pruning in Quiescence Search
- Move Ordering:
- Transposition Table (TT) move
- Good captures sorted by MVV-LVA and SEE
- Killer moves (2 slots per ply)
- Countermove heuristic
- History heuristic with aging
- Losing captures demoted below quiet moves
- Transposition Table: 64-bit PolyGlot Zobrist hashing with mate-distance ply adjustments.
- Opening Book: Native PolyGlot (
.bin) binary search support. - Model Packaging: Single
.gmarchive containing model weights, and metadata loaded directly from memory.
| Component | Specification |
|---|---|
| Input Features | 1,729 sparse geometric features ( |
| Feature Transformer | Dual accumulator ( |
| Hidden Layers | |
| Activation |
Dual Activation ( |
| Output |
|
| Loss Function |
Dual Loss: |
Perft test on the standard starting position:
| Library | Depth | Nodes | Time | Speed |
|---|---|---|---|---|
python-chess (baseline) |
4 | 197,281 | 1.83 s | ~108,000 NPS |
custom bitboard (Numba JIT) |
4 | 197,281 | 0.034 s | ~5,720,000 NPS |
- Python 3.9 or higher
- NumPy
- Numba
- ONNX Runtime
Install dependencies via pip:
pip install -r requirements.txtClone the repository:
git clone https://github.com/memeviber/guitarfish-chess-engine.git
cd guitarfish-chess-engineLaunch the engine via command line:
python guitarfish.py guitarfish.gm book.binStandard UCI commands example:
uci
isready
position startpos moves e2e4 e7e5
go depth 10
The engine outputs standard UCI search information (depth, seldepth, score, nodes, nps, pv) and terminates with bestmove.
Guitarfish is compatible with lichess-bot.
Example config.yml snippet:
engine:
dir: "./"
name: "python"
arguments:
- "guitarfish.py"
- "guitarfish.gm"
- "book.bin"
protocol: "uci"
ponder: false- Image Credit: Shovelnose guitarfish photo by Jot Powers, color-adjusted by Togabi via Wikimedia Commons, licensed under CC BY-SA 2.0, further edited by memeviber.
- AI Assistance: This engine was developed with the assistance of Gemini, accelerating algorithmic design, debugging, and overall development speed by an estimated 16x.
This project is open-source and available under the Apache License 2.0.
