~2650 Elo · C · UCI · Alpha–Beta · Magic Bitboards
Echo is a bitboard chess engine focused on performance and a classical alpha–beta search architecture and evaluation.
Technical Deep Dive: For a detailed breakdown of Echo's architecture, search heuristics, and evaluation function, see DOCUMENTATION.md.
- Protocol: UCI (Universal Chess Interface) compatible.
- Algorithm: Negamax with Alpha–Beta Pruning.
- Refinements: PVS, Iterative Deepening, Aspiration Windows.
- Pruning: Null Move (NMP), Futility, Reverse Futility (RFP).
- Heuristics: Killer Moves, History Heuristic, LMR.
- Quiescence: Mitigating horizon effects with capture-only searches.
- Optimization: Transposition Table (TT) with Zobrist Hashing.
- Multi-threading: Parallel Search using OpenMP.
- Tapered Eval: Smooth interpolation between middlegame and endgame.
- Pawn Structure: Passed (connected!), isolated, and doubled pawn detection.
- King Safety: Pawn shields, storm detection, and battery threats.
- Piece Activity: Mobility, Knight outposts, and Rook open file bonuses.
The codebase is modularized into the src/ directory, separating concerns between board representation, search, evaluation, and protocol handling.
/
├── src/
│ ├── main.c # Entry point
│ ├── board.c # Board state, bitboard macros, FEN parsing
│ ├── search.c # Search algorithms (Negamax, PVS, Quiescence)
│ ├── eval.c # Static evaluation logic & PSTs
│ ├── move_gen.c # Move generation (pseudo-legal & legal)
│ ├── tt.c # Transposition table & Zobrist hashing
│ ├── uci.c # UCI protocol handling & input loop
│ ├── magic.c # Magic bitboard generation (Rook/Bishop sliders)
│ ├── masks.c # Pre-calculated attack masks (Leapers)
│ ├── sliding_masks.c # Sliding piece attack lookups
│ └── helper.c # Debugging utilities (print board, etc.)
├── ref/
│ ├── colSelector.py # Development helpers
│ └── rowSelector.py
├── Makefile
└── README.md
- GCC or Clang
- Make
mkdir -p bin
make # Standard build
make rel # Release build (Optimized -Ofast -flto)
make win # Cross-compile for Windows (requires MinGW)./bin/echoEcho integrates with any UCI-compliant GUI (e.g., Arena, CuteChess, En Croissant).
Supported Commands:
uci
isready
ucinewgame
position startpos | position fen <FEN>
go depth <N> | go movetime <ms>
bench <depth>
stop
quit
Echo includes a built-in benchmark command to measure search performance across various positions.
To run the standard benchmark suite (8 positions to depth 10):
bench
To run benchmarks to a specific depth:
bench <depth>
Standard benchmark results (Depth 10):
Total Nodes: 626688
Total Time: 2297 ms
NPS: 272828
This table maps core engine concepts to their specific implementation files in the new structure.
| Concept | File Location | Key Functions |
|---|---|---|
| Search Logic | src/search.c |
negamax, search_position |
| Quiescence | src/search.c |
quiescence_search |
| Evaluation | src/eval.c |
eval() |
| Move Generation | src/move_gen.c |
generate_moves, make_move |
| Transposition Table | src/tt.c |
probeTT, storeTT |
| Zobrist Hashing | src/tt.c |
init_hash_keys, update_hash_key |
| UCI Protocol | src/uci.c |
parse_position, parse_go |
| Magic Bitboards | src/magic.c |
find_magic_number |
| Board Rep | src/board.c |
parse_fen, bitboards[] |
| LMR & Pruning | src/search.c |
inside negamax loop |
| Move Ordering | src/search.c |
score_move, sort_moves |
Utility functions found in src/helper.c and src/board.c:
print_board()— ASCII/Unicode board visualizationprint_bitboard()— Visualizes specific bitmasksprint_move_list()— Lists generated moves for the current state
The development of Echo was informed and inspired by several key resources in the chess programming community:
- Maksim Korzh (Code Monkey King): Foundational concepts in bitboard representation and move generation.
- Sebastian Lague: Algorithmic clarity regarding search architecture and optimization.
- BluefeverSoftware (VICE): Architectural patterns for UCI protocol handling and search structures.