What is left to do on this engine, for whenever I come back to it.
Development stopped on 2026-08-05 with the engine at roughly 2300 on Stockfish's ruler and 2187 in Lichess rapid. It stopped because the work was finished, not because it was going badly, so this file is a plan rather than a postmortem. The build log is the postmortem.
Everything below applies to the engine as it exists: mailbox board, CPython or PyPy, hand-crafted evaluation. None of it needs a rewrite. There is a rewrite analysis in the appendix, and I decided against it, but the research is worth keeping.
Two rules carry over from the build log and they are not negotiable. One change in flight at a time. Every item names the instrument that will judge it before any code gets written.
I measured these and they failed. Coming back after a gap, the temptation is to try the obvious thing, and for this engine several obvious things are already known to be wrong. Each one has a full entry in the build log.
| Idea | What the measurement said |
|---|---|
| Bitboard board representation | Slower than our mailbox in interpreted Python. 335k vs 393k perft NPS against python-chess. |
| Incremental evaluation accumulator | Reaches 5.8% of evaluate(), about 1.3% of search time. The claim was 22%. |
| Pawn hash | Ceiling of roughly 3% of search time. The pawn terms cannot be split out of the fused piece loop. |
| Staged move ordering | Neutral. Overlapping sample ranges on both interpreters. |
| History malus and gravity | 4.2% more nodes overall, 31% worse in the middlegame. |
| Late move pruning | 60 Elo worse, 24 after fixing a broken test. |
| Countermove history plus internal iterative reductions | Never measured on its own, so it went. |
The last two could plausibly be revisited, because both were measured years of engine-development-time ago in project terms, and the build log's own lesson is that a negative result expires when the code it measured changes. Best-move stability came back and worked for exactly that reason. But revisit them with a measurement, not with optimism.
books/book.json was built, committed, shipped, and then measured nothing,
because lichess-bot's polyglot book answered first for the entire opening of
every rated game. I flipped polyglot.enabled to false on 2026-08-05, so this is
unblocked but unplayed.
The work is not code. It is bringing the bot up, taking a fresh version cut, and letting it play twenty or thirty games so the book has a record of its own. The engine's opening play was the weakest phase in the Stockfish grading (ACPL 13.3 in moves 1 to 15, which looks good until you notice the Komodo book was playing those moves, not us).
Instrument: sf_watch game records, filtered to the new version cut. The
question is whether our own book keeps opening ACPL near where Komodo's had it.
Effort: an evening of bot uptime. No code.
This is the only known live strength bug, and it comes with a position:
5Q2/8/2p1q1k1/2P5/3P2pp/8/1r4PK/5R2 w
From game JvxRHGJa the engine played Qd6, trading queens into a rook ending.
Stockfish scores that at -2.52 against -0.41 for keeping queens on with Qf4.
Two pawns of swing, and it lost the game.
The engine still picks Qd6 at full depth, so this is the static evaluation and
not the horizon. It overvalues its own c and d pawns, which are blockadable, and
undervalues Black's connected g and h pawns sitting next to the white king.
Candidate fix: a passed-pawn term that scales with rank and with the distance from both kings, plus something that discourages trading into a worse pawn structure. The existing passed-pawn weights were Texel-fitted, so refit them alongside any new term rather than hand-picking on top of fitted values.
Instrument: SPRT at 60+0.6, the way king safety was judged. Sanity-check on the position above first, because a fix that does not change that move is not a fix.
Effort: two or three days including the SPRT.
The highest value item on this list that the engine does not have. Record the signed gap between static evaluation and search score, indexed by a cheap positional feature, then use it to correct future static evaluations of positions sharing that feature.
Tcheran measured pawn-structure correction history at +21.8 and major/minor piece correction history at +18.9. It first appeared in Caissa in late 2023 and spread quickly, which is usually a sign that something is both real and cheap.
Two reasons it suits this engine specifically. It is pure search, so it needs no change to the board representation or the evaluation, which is where all this project's structural risk lives. And it scales better at longer time controls, which is the regime a slow engine lives in.
The implementation is a table indexed by a hash of the pawn structure, updated with a depth-weighted fraction of the error, applied at about 1/32 scale and clamped. Roughly a hundred lines.
Instrument: SPRT. Expect somewhere between 15 and 25 Elo if it lands like it did elsewhere.
Effort: two days.
Twenty-four evaluation constants were Texel-fitted in July and gained 20 Elo. The search constants were never touched: LMR reduction table, null-move R, futility margins, aspiration window width, delta pruning margin. There are roughly a dozen of them and every one was picked by hand from a reference implementation.
These cannot be Texel-fitted, because they do not predict game outcomes. They have to be tuned by playing games, which means SPRT per value or an SPSA loop. That is expensive on one machine, which is the honest reason this never happened.
Cheap version worth trying first: the LMR table. It is the single most valuable search feature in the engine (Tcheran measured LMR at +100) and its base formula has two free parameters. Two SPRTs would tell you whether the hand-picked values are near a local optimum.
Instrument: SPRT, one parameter at a time.
Effort: several days, most of it waiting.
Search the position again with the transposition-table move excluded and a lowered window. If no other move comes close, the TT move is singular, so extend it. Tcheran measured +19.9 at short time control and +34.0 at long, and the gap between those two numbers is the interesting part for an engine that plays rapid.
More delicate than correction history. It interacts with the extension and reduction logic, and a bad implementation quietly doubles the node count. Do it after correction history, not before.
Instrument: SPRT at both 60+0.6 and something longer, because the short number undersells it.
Effort: three or four days.
The engine maintains every move-related invariant twice: Move objects with
make_move for the UI, bare tuples with make_ai_move for the search. Sixty-four
references, and the 50-move-clock bug hid in exactly this seam for months.
This buys no Elo. It buys the ability to change make/unmake without holding two implementations in your head, which is what makes items like tablebase probing or an incremental accumulator less frightening than they currently are.
Instrument: perft plus the random-walk make/unmake test. Both must stay exact. This is a refactor, so identical bench node counts are the gate.
Effort: a week, and it is the least fun week on this list.
Syzygy probing is worth about 19 Elo for the 5-man tables, and it converts won endings the search fumbles.
There is a constraint that makes this awkward here. engine/ is deliberately pure
stdlib with zero dependencies, which is what lets it run under PyPy, and
python-chess provides the only sane Syzygy reader in Python. Three options, none
free:
- Take the dependency in the bot path only, keeping
engine/clean and the GUI unaffected. Least invasive, and the bot is where endgames actually get played. - Query the Lichess tablebase API over the network, which is what black_numba does. Fine for a bot, useless for offline analysis, and it adds latency to the clock.
- Write a minimal WDL-only Syzygy reader. Genuinely interesting, genuinely a week, and easy to get subtly wrong.
I would take the first option and note the exception in CLAUDE.md rather than
pretend the constraint does not exist.
Effort: two days for option one, plus downloading about 1 GB of 5-man tables.
Parallel search. Python 3.14's free-threaded build makes lazy SMP possible now, and it would be worth perhaps 60 to 80 Elo on four threads. But it multiplies existing strength rather than creating any, it makes every SPRT slower and noisier, and this engine's problem is not that it searches one tree too slowly.
Anything from the appendix. See below for why.
In August 2026 I researched what it would take to rebuild the engine as a Numba-compiled bitboard engine with a neural evaluation. The conclusion was not to do it, but the findings are worth keeping, because the next person to think "just use bitboards" deserves the numbers.
From a controlled study by Frederik Hennecke (Göttingen, 2025) that ported one Python engine six ways, plus this project's own measurements:
| Variant | Nodes per move | Elo vs. the CPython baseline |
|---|---|---|
| CPython 3.10 | 2,166 | baseline |
| CPython 3.12 | 2,401 | about 0 |
| Nuitka | 2,471 | about 0 |
| PyPy | 374 | -400 |
| Numba, partial | 4,520 | +290 |
| Cython | 9,284 | +270 |
| C++ behind a Cython wrapper | 231,069 | +380 |
The PyPy row is misleading and worth explaining, because it contradicts this
project's own experience. Their engine ran numpy in the hot loop, and numpy under
PyPy goes through the cpyext compatibility layer, which is slower than CPython.
Our engine is pure stdlib, which is exactly why PyPy helps us and hurt them.
For the record, since I got this wrong once: PyPy is worth about 27% on our
search (33,777 to 42,917 NPS, measured 2026-07-25) and 8.9x on an uncached
evaluate(). It earns its place.
@njit compiles Python to machine code through LLVM, and inside it a uint64 is
a real machine word rather than an arbitrary-precision heap object. That is the
one thing that would make bitboards worth having here, and it is the reason the
2026-07-19 measurement rejecting bitboards does not settle the question for a
compiled engine.
black_numba, a Numba bitboard engine, reports going from 7,300 NPS in pure CPython to over 1.5M compiled. Nothing else in the Python ecosystem does that without leaving Python.
The cost is severe constraints on the code: no classes, no dicts, no Python objects anywhere in the hot path, every move packed into an int32, all state in typed numpy arrays. Plus a cold-start compile of 20 to 45 seconds, which is why Antares, another Numba engine, cannot run under cutechess at all.
| Engine | NPS | Evaluation | Lichess blitz |
|---|---|---|---|
| black_numba | about 1.5M | hand-tuned tables | 1931 |
| Numbfish | about 14k | NNUE | about 2300 |
| PyCheckmate | 43k | Texel-fitted, hand-written | 2050 |
black_numba has a transposition table, PVS, LMR, null-move pruning, aspiration windows and quiescence. It runs 35 times more nodes than this engine and rates about 120 points lower, because its evaluation is worse. Numbfish runs 100 times fewer nodes than black_numba and beats it by roughly 370, because it has a neural network.
So the rewrite is really two projects. The compiler work buys headroom worth maybe 300 to 450 Elo, and only if per-node quality survives the port. The NNUE is what fills it, and Tcheran measured that switch at +224.
Together, eight to eleven weeks for a projected 2700 to 2800.
CPyCheckmate already exists and is 58 times faster, so the raw strength question moved to a different repository. Rebuilding this engine as a bitboard NNUE engine would produce a new engine wearing an old name, and the interesting question this project was built to answer, how far honest measurement gets you in plain Python, is already answered.
If I ever do want it, the brief is above and it should start as its own repository.
Reference material: Chess Programming Wiki, particularly correction history, singular extensions and LMR. Stockfish's NNUE documentation. python-chess Syzygy probing.
Measured evidence: Tcheran's changelog, which publishes SPRT Elo per feature and is the source of every Elo figure quoted above. Hennecke's seminar report. black_numba and its Lichess profile. Numbfish.