A UCI chess engine written in Go, built on the
dragontoothmg magic-bitboard legal
move generator.
Early. The engine plays legal chess via a UCI loop with:
- Move generation — delegated to
dragontoothmg(verified with perft). - Evaluation — tapered PeSTO material + piece-square tables, bishop pair, passed pawns, mobility, king safety, tempo.
- Search — iterative deepening with aspiration windows, principal variation
search, quiescence search, a shared aged transposition table with hash-move
ordering, MVV-LVA + killer-move + history move ordering, null-move pruning,
late move reductions, Lazy SMP (multi-threaded search), asynchronous search
with working
stopand pondering, hard time limits. - Opening book — optional Polyglot
.binbook.
Not yet implemented: Syzygy endgame tablebases, static exchange evaluation. See the roadmap.
go install github.com/cjunius/goChess/cmd/gochess@latestOr build from source:
git clone https://github.com/cjunius/goChess
cd goChess
make build # produces ./bin/gochessgochess # UCI mode — point a GUI (CuteChess, Arena) at this
gochess perft 6 # timed perft series from the start position
gochess perft 4 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"
gochess bench # fixed search benchmark (nodes/sec)
gochess versionAdd the binary as an engine in any UCI GUI, or pipe commands directly:
setoption name Hash value 128
setoption name Threads value 8
position startpos moves e2e4 e7e5
go movetime 1000
| Option | Default | Range | Meaning |
|---|---|---|---|
Hash |
64 | 1–4096 | Transposition-table size in MiB. |
Threads |
1 | 1–256 | Lazy-SMP worker count (capped at the machine's core count at search time). |
Ponder |
false | check | Let a GUI drive go ponder / ponderhit so the engine thinks on the opponent's clock. |
OwnBook |
false | check | Play from the Polyglot book when the position is in it. |
BookFile |
— | string | Path to a Polyglot .bin book; loaded when set. |
make test # go test -race ./...
make lint # golangci-lint
make vuln # govulncheck
make cover # coverage reportSee CONTRIBUTING.md and docs/development.md.
cmd/gochess/ main entry point + CLI subcommands
internal/engine/ perft, evaluation, search
internal/uci/ UCI protocol loop
docs/ architecture notes and ADRs
- Move generation on
dragontoothmg+ perft regression tests -
Evaluate(pos)— material + piece-square tables - Negamax + alpha-beta + iterative deepening + time budget
- UCI loop
- Quiescence search + MVV-LVA move ordering
- Transposition table (Zobrist hash from
dragontoothmg) + hash-move ordering - Lazy SMP — multi-threaded search over the shared TT (
ThreadsUCI option) - Killer moves + history heuristic
- Null-move pruning + late move reductions
- Aspiration windows + principal variation search
- Tapered PeSTO evaluation + pawn/mobility/king-safety terms
- Asynchronous search — working
stopand pondering - Opening book (Polyglot)
- Syzygy tablebase probing (ADR 0003)
- Strength testing harness (SPRT via cutechess-cli)
GPL-3.0. dragontoothmg is also GPL-3.0.