Why it exists
turox is practice in performance work where the result is measured, not argued.
Chess suits that well: move generation has an exact answer to check against,
speed is a number, and playing strength can be settled by a statistical test
instead of a hunch. Chess is the vehicle, not the point; the point is profiling,
target-feature tuning, and changing code because a measurement said to.
The target that gives the work something to aim at is a real rating. The engine speaks UCI well enough to play on Lichess, where it meets thousands of human and engine opponents it was never tuned against.
How it works
The board is a set of 64-bit bitboards. Sliding-piece attacks come from magic bitboard tables whose multipliers are found by search, written out by a generator, and checked on every push against a naive ray walk. Search is negamax with alpha-beta over iterative deepening, with quiescence, a transposition table, killer moves, and time management. Evaluation is tapered between midgame and endgame.
The code is split into crates with a one-way dependency that the compiler
enforces: turox-chess holds the rules of chess, turox-engine holds the part
that plays, and turox-notation holds how a game is written down. Neither the
rules nor the engine takes a runtime dependency.
Evidence
Speed was measured on a 2017 dual-core laptop (Intel Core i5-7267U), with
cargo bench -p turox-engine and the perft driver:
| Measure | Result | How |
|---|---|---|
| Perft | 18 to 19M positions / s | start position, depth 5, best of 7 |
| Search | 650k to 736k nodes / s | same build |
| Legal move generation | 46.9 ns per move | median of three best-of-15 runs |
The gap between the first two rows is not a contradiction. Perft counts the last ply without playing it, so a perft node is far cheaper than a search node that also evaluates, probes the transposition table, and sorts. The more useful finding is what a search node costs: one legal move generation call takes about 1.6 microseconds, and a node at 700k nodes a second has about 1.4 microseconds in total. To a first approximation, move generation is the node cost, which is where the board representation research goes next.
CI checks only that the benchmarks compile; shared runners vary too much run to run for the numbers to mean anything on a pull request. A weekly job runs them for the record.
Benchmarks say whether a change made the engine faster, not whether it plays
better. For that, tools/selfplay/sprt.sh builds two versions and plays them
against each other over a 2,494-position opening suite under a sequential
probability ratio test (bounds 0 and 10 Elo, 5% error each way), so an
evaluation or search change gets a pass or fail from games. A refactor that
claims to change nothing is checked more cheaply: the same node counts and
principal variations across a fixed set of positions, at the same speed, mean
playing strength is unchanged by construction.
On Lichess, turox-bot is rated 2019 in bullet over 868 rated games and 1954 in blitz over 1,040, as its public profile shows.
Key decisions
The repository keeps eight ADRs. Three show how choices get made here:
- Accept bounded path-dependence in the transposition table. The table ignores how a position was reached, so a repetition draw can leak into an ancestor’s score. The published fixes exist, but they cost more than they return at this strength: the error shows up as half points in specific endgames, while the engine still loses games by whole pawns.
- Own opening book format, not Polyglot. Polyglot needs no engine code under the Lichess runner, but works only there, and brings a second hashing scheme and a castling encoding that had already caused bugs. The engine’s own format reuses its existing hash and serves every host from one file.
- Chess primitives in their own crate. The build-time case was thin (about 11 seconds saved on a build nobody waits on). The split was made for legibility: a crate graph states the layering in a way a module tree cannot.
Status and what’s next
turox plays. It speaks UCI end to end and runs on Lichess under a supervisor script that restarts it after a crash or stall and keeps the laptop awake. The current version is 0.1.0, with no tagged release yet; planned work lives on the issue tracker.
Next, the bot and its SPRT matches move off the laptop: the bot to an always-on cloud host, and the matches to on-demand cloud machines that contributors can run in their own accounts.
Recent changes
Aspiration windows cut search nodes by 3.2%
From depth 5, each iteration searches a narrow window around the previous score and reopens it if the result escapes. Over the tree-shape suite that took 3.2% fewer nodes at depth 9. The change landed as four commits, the first of them provably move-identical.
Late move reductions pass the SPRT gate
Quiet moves that move ordering puts late are searched shallower, and re-searched at full depth only if the shallow result looks good. The SPRT accepted it after 294 games at 10+0.1, an estimated 88 Elo (plus or minus 31), and the effective branching factor fell from 3.84 to 2.77.
The engine now opens from a real book built from 3.4 million games in the Lichess Elite Database (December 2024 to November 2025, players rated 2000 and up, ten moves per side) and embedded at compile time.