Moonfish is a user-friendly Python chess engine that achieves approximately 2000 Elo. It is designed to illustrate advanced programming techniques and parallel search algorithms. With an emphasis on code readability, Moonfish serves as a practical alternative to traditional C++ engines and includes a comprehensive suite of test positions.
Moonfish is an educational Python chess engine that serves as an excellent resource for understanding parallel search algorithms and modern chess programming techniques. It is designed with a focus on code clarity, making it an approachable alternative to traditional C++ engines. With an estimated Elo rating of around 2000 when competing against Lichess Stockfish bots, Moonfish defeats level 5 bots while facing challenges against level 6. Comprehensive test suites, including the renowned Bratko-Kopec tactical test positions, are included to demonstrate its capabilities.
Features
Advanced Search Algorithms
- Negamax with Alpha-Beta Pruning: Efficiently evaluates chess positions using alpha-beta cutoffs to enhance search performance.
- Lazy SMP (Shared Memory Parallelism): Utilizes all available CPU cores for a faster search process.
- Layer-based Parallelization: Distributes computational workload at designated search depths for improved performance.
- Null Move Pruning: Skips certain moves to identify zugzwang positions and optimize decision-making.
- Quiescence Search: Conducts extended searches for tactical scenarios to increase accuracy in critical positions.
Evaluation and Optimization Techniques
- PeSTO Evaluation: Implements piece-square tables (PST) with tapered evaluations, providing nuanced board position assessments. Learn more about Rofchade's PST.
- Transposition Tables: Uses caching to prevent redundant calculations, enhancing overall efficiency.
- Move Ordering: Integrates the MVV-LVA (Most Valuable Victim - Least Valuable Attacker) strategy to prioritize optimal move selection.
- Syzygy Tablebase: Supports perfect endgame play through the use of pre-calculated tablebases.
- Opening Book Integration: Incorporates an opening book in Cerebellum format for enhanced gameplay.
Multiple Engine Interfaces
- UCI Compatible: Functions with popular chess GUI applications through the UCI protocol.
- RESTful Web API: Offers an easy integration method for online platforms.
- Lichess Bot Deployment: Prepares for straightforward deployment on Lichess.org.
Configuration Options
Configure various engine parameters easily to tailor the operation:
| Parameter | Description | Default | Options |
|---|---|---|---|
--mode | Engine mode | uci | uci, api |
--algorithm | Search algorithm | alpha_beta | alpha_beta, lazy_smp, parallel_alpha_beta_layer_1 |
--depth | Search depth | 3 | 1-N |
--null-move | Enable null move pruning | False | True, False |
--null-mov-r | Null move reduction factor | 2 | 1-N |
--quiescence-search-depth | Max depth for quiescence search | 3 | 1-N |
--syzygy-path | Tablebase directory | None | Valid path |
Moonfish encourages contributions in almost all areas, including new search algorithms, improved evaluations, time constrained searches, and performance benchmarking across different hardware. For more information and to get involved, please refer to the contributing guidelines.
No comments yet.
Sign in to be the first to comment.