Appendix B — Data Dictionary and Toolkit Reference
Every number in this book comes from a small set of downloaded datasets and one engine. This appendix
documents them: where each table came from, its licence, the period it covers, how many rows it has, what
every column means, and — most important for anyone who wants to reproduce or extend the book — the quirks
that will silently change your answer if you do not know about them. The second half is the reference for
the book's toolkit, the four Python modules (chessdata, engine, boards, structures) that every
chapter imports.
The row counts, dtypes and quirks below were re-measured for this appendix by running code against the
data snapshot, not copied from elsewhere. The scripts and their full outputs are in appendices/code/:
| Script | What it checks |
|---|---|
b01_dataset_profile.py |
schema (column names and types) of every processed table, non-null shares, example values |
b02_quirks_and_counts.py |
row counts, date ranges, bot and flag counts, weights, the known quirks, the cache sizes and the reference tables |
b03_toolkit_examples.py |
one call to every toolkit function listed in B.13–B.16, with its output |
If you have not used Python before, read Appendix A first; the code in this appendix assumes its standard script header.
B.1 The snapshot at a glance
Table (data/processed/ unless stated) |
Rows | Size | Source and licence | Period | What it is — and is not |
|---|---|---|---|---|---|
lichess_games.parquet |
4,000,000 | 115 MB | Lichess open database, standard rated games; CC0 | 2026-10-01 00:00 → 2026-10-02 10:14 UTC | the first four million rated standard games of October 2026: online, mostly fast, Glicko-2 ratings. Not a random sample of a year; not a panel of players |
lichess_moves.parquet |
864,816 | 467 MB | same | same | move text with [%clk] (and [%eval] where Lichess analysed the game) for every analysed game plus one in eight of the rest |
broadcast_games.parquet |
373,918 | 19 MB | Lichess broadcast database (over-the-board games relayed on lichess.org/broadcast); CC0 | monthly files Nov 2025 → Oct 2026 | the book's over-the-board (OTB) database, FIDE ratings in the headers; skews towards events strong or organised enough to be relayed |
broadcast_moves.parquet |
373,918 | 320 MB | same | same | move text with [%clk] (97%) and relay [%eval] (about 90%) |
master_games.parquet |
97,833 | 26 MB | PGN Mentor player collections (free downloads from pgnmentor.com) | 1749 → 2026 | the historical record of 40 great players. Not a random sample of master play; includes rapid, blitz, simultaneous and blindfold games without a speed tag |
fide_players.parquet |
1,959,064 | 32 MB | FIDE combined rating list (ratings.fide.com download) | file dated 2026-11-20 | one cross-section of the FIDE list: standard, rapid and blitz ratings, titles, federations, birth years. No history per player |
puzzles.parquet |
6,193,530 | 357 MB | Lichess puzzle database; CC0 | download of November 2026 | puzzles generated from Lichess games, with Glicko-2 puzzle ratings (not player ratings) and theme tags |
game_features.parquet |
1,235,818 | 123 MB | built by scripts/build_features.py from the two move tables |
as its sources | one row per game with move text: castling, structures, endgame entry, per-phase accuracy and much more |
positions_sample.parquet |
199,986 | 7 MB | built by the same script | as its sources | one random position per sampled game, stratified by source × rating band × phase, with weights |
data/cache/chesscom/*.parquet |
71,786 + 34,410 | — | Chess.com Published-Data API (public archives) | Hikaru 2014-01 → 2026-11; GothamChess 2017-03 → 2026-11 | two public accounts (Hikaru Nakamura, Levy Rozman). No Chess.com population data |
data/cache/explorer/*.json |
108 files | — | Lichess opening explorer, masters database | retrieved 2026-11-20 | cached answers for specific positions |
data/cache/tablebase.sqlite |
2,509 probes | — | Syzygy tablebases via tablebase.lichess.ovh | retrieved as used | exact results for positions with at most seven pieces |
data/cache/engine.sqlite |
170,524 evaluations | — | Stockfish 19, run on the book's machine | as used | every engine evaluation quoted in the book |
data/reference/* |
15 tables + 17 anchor diagrams | small | computed from the above | — | summary tables the chapters quote (B.12) |
Two counts above are moving targets: the engine and tablebase caches grow whenever someone runs new
analysis. The numbers are what b02_quirks_and_counts.py found when this appendix was written.
⚠️ Common pitfall: treating the four sources as one population. Lichess ratings (Glicko-2, new players start at 1500), Chess.com ratings (Chess.com's own Glicko-based pools, one per time control) and FIDE ratings (Elo, over the board) are different scales. A "1600" means something different in each, and the relationship between them changes with level and time control. Always name the pool — "Lichess blitz 1600", "FIDE 1850" — and never convert between pools as if it were a fact.
B.2 Conventions shared by every table
| Convention | Rule |
|---|---|
game_id |
an integer key within one source. game_features and positions_sample carry a source column; join on (source, game_id) — a Lichess game and a broadcast game can share an id |
score_white |
White's points: 1, 0.5 or 0 (NaN for an unfinished game) |
avg_elo |
mean of the two ratings — the basis of every rating band, as in the Lichess opening explorer |
elo_diff |
White's rating minus Black's (added by chessdata.lichess_games) |
| Rating bands | 200-point bands of avg_elo: <1000, 1000-1199, …, 2200-2399, 2400+ (chessdata.rating_bands). Many tables merge the two lowest into <1200 |
| Balanced game | |white rating − black rating| ≤ 100. Opening and structure statistics use balanced games unless stated |
| Players | Lichess usernames are replaced by salted hashes (white_id, black_id); amateurs are never named. Broadcast and master games carry real names of tournament players |
| Missing values | numbers are NaN; strings use pandas' nullable string type, so a missing title is <NA> — see B.10 for why that matters |
| Evaluations | White's point of view, centipawns, clipped to ±1000 in every derived metric |
| Speeds (Lichess) | estimated duration = base + 40 × increment (seconds): ultrabullet < 29, bullet < 179, blitz < 479, rapid < 1499, classical ≥ 1500; no clock = correspondence |
| Speeds (OTB) | the FIDE classes on base + 60 × increment: classical ≥ 60 min, rapid > 10 min, blitz ≤ 10 min (B.5) |
B.3 lichess_games — four million rated online games
Source. The Lichess open database (database.lichess.org), the monthly file of rated standard games for
October 2026, read from the start until four million games had been collected. Released under CC0 (public
domain dedication). Period: the first game started 2026-10-01 00:00:00 UTC, the last 2026-10-02 10:14:37
UTC — about 34 hours on a Thursday and Friday. Loader: chessdata.lichess_games().
rows 4000000
first/last start: 2026.10.01 00:00:00 / 2026.10.02 10:14:37
games with a BOT: 20948
has_eval: 416869 (10.4%)
distinct players: 757100
speed
blitz 1843771
bullet 1418967
rapid 673559
ultrabullet 36612
classical 23320
correspondence 3771
results: {'1-0': 1988348, '0-1': 1857922, '1/2-1/2': 153330, '*': 400}
terminations: {'Normal': 2700376, 'Time forfeit': 1288507, 'Abandoned': 10023, 'Insufficient material': 649, 'Unterminated': 349, 'Rules infraction': 96}
| Column | Type | Meaning |
|---|---|---|
game_id |
int64 | row key, 0 … 3,999,999 in file order |
site |
string | Lichess game id (internal — the book never prints it) |
event |
string | e.g. Rated Blitz game, or a tournament name with its URL |
speed |
string | Lichess speed class from the time control (B.2) |
utc_date, utc_time |
string | start of the game, 2026.10.01, 00:00:25 |
white_id, black_id |
string | salted hash of the username (757,100 distinct players) |
white_title, black_title |
string (nullable) | GM, IM, …, BOT, LM; <NA> for the 99% without a title |
result |
string | 1-0, 0-1, 1/2-1/2, or * (400 unfinished games) |
white_elo, black_elo |
float32 | Lichess Glicko-2 ratings before the game (not FIDE) |
white_rating_diff, black_rating_diff |
float32 | rating change from this game (present for 99.5%) |
eco |
string | ECO code assigned by Lichess's opening classifier |
opening |
string | Lichess opening name, Family: Variation, Line |
time_control |
string | base+increment in seconds, e.g. 180+2; - for correspondence |
termination |
string | Normal, Time forfeit, Abandoned, Insufficient material, Unterminated, Rules infraction |
plies |
int64 | half-moves played |
has_eval |
bool | Lichess's server analysed the game ([%eval] on every move) |
month |
string | 2026-10 |
added by the loader avg_elo, elo_diff, score_white |
float | see B.2 |
The most common time controls are 60+0 (26.3% of games), 180+0 (19.2%), 600+0 and 300+0 (12.6% each) and 180+2 (8.9%). The median average rating is 1,652.5 (interquartile range 1,367.5–1,913.0) among human games.
Quirks.
- A 34-hour window. The sample is a time slice, not a random sample of a year: it carries the time-of-day pattern of one Thursday and Friday (the busiest hour, 18:00 UTC on 1 October, had more than twice the games of the quietest). Population statements are about "rated standard games on Lichess in early October 2026".
- Bots. 20,948 games involve an account with the
BOTtitle. They are excluded from every human statistic.chessdata.lichess_games()drops them by default (3,979,052 games remain). - The analysed games are self-selected. Only 10.4% of games carry server evaluations, because a player asked for the analysis. Those games differ from the rest — they are twice as often rapid and much less often lost on time (Appendix E, E.4) — so engine-based Lichess numbers describe analysed games.
- Ratings are Glicko-2. New accounts start at 1500 and move quickly; at club level Lichess ratings tend to be higher than the FIDE ratings of comparable players, by an amount that varies with level and speed. Applying the Elo formula to them is an approximation that over-predicts favourites (see Appendix D, D.4).
- Unfinished games. 400 games have result
*; drop them before computing scores (score_whiteisNaNfor them).
B.4 lichess_moves — the move text
| Column | Type | Meaning |
|---|---|---|
game_id |
int64 | joins to lichess_games.game_id |
movetext |
string | SAN moves with comments: 1. e4 { [%eval 0.18] [%clk 0:10:00] } 1... e5 { ... } |
Which games are here. All 416,869 server-analysed games, plus a systematic one-in-eight sample of the
rest — 864,816 games in all. 99.8% carry [%clk] comments (remaining time after the move); 48.2% carry
[%eval] (the analysed ones). The Lichess [%eval] is the evaluation of the position after the move,
from White's point of view, in pawns (0.18) or as a mate (#3, #-2). Analysed games also carry ?,
?! and ?? suffixes on moves, which chessdata.parse_movetext strips. Appendix C shows the comment syntax
in detail.
⚠️ Common pitfall: the one-in-eight sampling means that any statistic computed on
lichess_moves(or ongame_features, built from it) over-represents analysed games by a factor of eight. Usesample_weight(B.8) for population estimates.
B.5 broadcast_games and broadcast_moves — the over-the-board database
Source. The Lichess broadcast database: tournament games played over the board and relayed live on
lichess.org/broadcast, published monthly under CC0. The book uses the twelve monthly files from November
2025 to October 2026. Loaders: chessdata.broadcast_games() and chessdata.broadcast_moves(ids).
all rows: 373918 | events: 210059 | broadcasts: 3985
variant: {'Standard': 371007, 'Chess960': 2842, 'Fischerandom': 33, 'King of the Hill': 25, 'fischerandom': 11}
default loader (Standard, completed): 366653
engine_game: 3880 | online: 3578
human OTB set: 359195
speed: {'classical': 236560, 'rapid': 68030, 'blitz': 47526, None: 7079}
has_eval share: 90.3 | has_clock share: 96.5
both ratings: 310067
avg_elo median: 2038.5
The human OTB set — Standard variant, completed, not an engine event, not an online event, no BOT title — has 359,195 games, 310,067 of them with both players' FIDE ratings, median average rating 2,038.5. This is the set the book means by "OTB".
| Column | Type | Meaning |
|---|---|---|
game_id |
int64 | row key; joins to broadcast_moves |
event |
string | the PGN Event tag — for some relays this is Round 5: White - Black, not the tournament |
broadcast |
string | the broadcast (tournament) name — use this when event is a round label (3,985 distinct) |
site, game_url |
string | broadcast and game URLs on lichess.org |
date, utc_date |
string | PGN Date / UTCDate tags (2025.10.31; ????.??.?? when unknown) |
year, month |
float | from the date |
round, board |
string | round label (5.1), board number (rarely present) |
white, black |
string | player names as relayed (Surname, Firstname usually) |
white_fide_id, black_fide_id |
string | FIDE ids (94% present) — join to fide_players |
white_title, black_title |
string | FIDE titles where given (about 39%) |
white_elo, black_elo |
float32 | ratings in the headers — FIDE in almost all events (91% present) |
white_team, black_team |
string | team events (17%) |
result |
string | 1-0, 0-1, 1/2-1/2, * |
eco, opening |
string | ECO code and opening name assigned by Lichess |
variant |
string | Standard, Chess960, … |
has_setup |
bool | game starts from a set-up position |
time_control |
string | the PGN TimeControl tag as typed by the organiser (90+30, 5400+30, 90'+30'', free text, or missing) |
base_s, inc_s |
float32 | inferred base time and increment in seconds (see quirks) |
termination |
string | rarely present (3.6% of human OTB games) |
plies |
int64 | half-moves |
has_eval, has_clock |
bool | the move text carries [%eval] / [%clk] |
source_file |
string | broadcast_2025-11.pgn.zst … broadcast_2026-10.pgn.zst |
online |
bool | the broadcast or event name says the games were played online |
engine_game |
bool | a computer event (a BOT title, or TCEC / CCC in the name) |
speed |
string | classical, rapid, blitz or None (FIDE classes on base + 60 × increment) |
avg_elo, score_white |
float | see B.2 |
Quirks.
- Not everything relayed is OTB chess. 3,880 games come from engine events and 3,578 from online events;
another 2,911 are Chess960 or other variants (excluded by the default loader). Filter
~engine_gameand~onlineyourself for any "OTB" statistic. Note thatbroadcast_games(speed="classical")alone still returns 246 engine games. - Dates. The files are monthly relay dumps from November 2025 to October 2026, but the PGN
Datetag is whatever the organiser entered: the earliest is 2025.05.07, and some games have????.??.??. Usesource_filefor "when was it relayed" anddatefor "when was it played" — and expect a few errors. base_susually includes the first increment. The base time is inferred from the first clock readings (the larger of plies 1–2, rounded to the minute), because theTimeControltag is unreliable. Clocks shown after move 1 already include the increment for that move, so a 90+30 game typically reads 5,460 s, not 5,400 s: of 92,027 human OTB games tagged90+30or5400+30, 76,035 havebase_s = 5460and 11,007 have 5,400. The median first clock reading after move 1 in a sample of those games was 5,455 s. For 3+2 blitz the rounding hides it (25,156 of 25,525 games read 180 s). Subtract the increment if you need the nominal base, and never assumebase_sequals the tag.inc_sis often missing. It is parsed fromTimeControl, which is missing for 31.6% of human OTB games;inc_sis missing for 35.7%. The speed class then assumes no increment.TimeControlunits vary."90+30"in a broadcast header means minutes and seconds;"5400+30"means seconds. Never pass a broadcast tag tochessdata.speed_from_tc(which assumes seconds) — use thespeedcolumn.- Evaluations are relay evaluations. The
[%eval]comments come from Lichess's cloud and relay engines at varying depths; the book treats eval-based broadcast statistics as indicative and makes every per-game engine claim with its own Stockfish 19 run. - Ratings below about 1400 are often national. Many junior and open events relay national ratings in the Elo fields; the book's Elo calibration uses games with both ratings ≥ 1400 for this reason.
- Results without terminations. Only 3.6% of human OTB games carry a
Terminationtag. A decisive game whose final position is not mate is "resignation or loss on time — we cannot tell which". - Duplicates. Identical relays (same players, date and moves) were removed when the table was built; games with zero moves (forfeits and unplayed boards) were dropped.
B.6 master_games — the historical record
Source. The free player collections from PGN Mentor (pgnmentor.com): one PGN file per player, for 40
great players from Philidor and Morphy to Gukesh. Games that appear in two collections (Kasparov–Karpov is in
both files) were deduplicated on players, date and moves; collections lists every file a game was found in.
Loader: chessdata.master_games(player=None); search with chessdata.find_game(...).
| Column | Type | Meaning |
|---|---|---|
game_id |
int64 | row key (Kasparov–Topalov 1999 = 53009; the Opera Game = 67113) |
white, black |
string | names as in the source file — spellings vary (Kasparov, Gary and Kasparov,G) |
event, site, date, round |
string | PGN tags (date often 1858.??.??) |
year |
int64 | from the date |
result |
string | 1-0, 0-1, 1/2-1/2 |
eco |
string | ECO code from the source |
white_elo, black_elo |
float32 | Elo where the source gives one (80% of games — none before ratings existed) |
has_setup |
bool | starts from a set-up position (none in this table) |
plies |
int64 | half-moves |
pgn |
string | the full PGN text as distributed (headers + moves) |
collections |
string | ;-joined collection names, e.g. Kasparov;Topalov |
score_white |
float | see B.2 |
rows: 97833 | years: 1749 - 2026 | collections: 40
has_setup: 0 | with both Elo: 77451
Opera game: [{'game_id': 67113, 'white': 'Morphy, Paul', 'black': 'Duke Karl Count Isouard', 'event': 'Paris it', 'date': '1858.??.??', 'plies': 33}]
Kasparov-Topalov 53009: [{'white': 'Kasparov, Gary', 'black': 'Topalov, Veselin', 'event': 'Hoogovens', 'date': '1999.01.20', 'round': '4', 'plies': 87}]
Collection sizes range from Nakamura (10,220 games) and Carlsen (7,818) down to Morphy (211) and Philidor (6);
data/processed/master_games_coverage.csv has the full list with first and last years. Modern decades dominate:
the 2020s alone contribute 33,611 games.
Quirks.
- No speed tag. Blitz, rapid, simultaneous, blindfold and exhibition games sit next to classical games.
Filter by
eventtext (the book's era studies drop events whose names mention blitz, rapid, simul, blindfold, online or exhibition — a heuristic that lets a few tie-breaks through). - Name variants. Within one collection a player can appear under two spellings; any per-player study must
match both (a substring such as
"Kasparov"usually does). - First match wins.
find_gamereturns all matches in table order; when two players met many times, addyear=,event=orresult=until one row is left (Zsuzsa Polgar–Smyslov 1993 matches both a veterans' event and a blitz game). - Transcription variants. Older games were transcribed many times; a move can differ from another source's version. The book takes moves from this table and replays them through python-chess.
- Curated, not random. A collection is the games someone chose to publish; style and accuracy statistics describe the collection, not the whole career.
B.7 fide_players — the FIDE rating list
Source. FIDE's combined rating list (standard, rapid, blitz), the file dated 2026-11-20, from FIDE's
public download page. Loader: chessdata.fide_players().
rows: 1959064 | std-rated: 573475 | std active: 223908 | rapid: 486148 | blitz: 321078 | women: 308733
flag values: {<NA>: 1340338, 'i': 309993, 'w': 269159, 'wi': 39574}
std rating min/median(active)/max: 1400.0 1699.0 2823.0
titles: {'FM': 9920, 'IM': 4321, 'CM': 4056, 'WFM': 2269, 'GM': 1904, 'WCM': 1509, 'WIM': 946, 'WGM': 341}
| Column | Type | Meaning |
|---|---|---|
fide_id |
int64 | FIDE identifier (joins to broadcast_games.white_fide_id after converting to string) |
name, fed, sex |
string | name, three-letter federation code, M/F |
title |
string | GM, IM, FM, CM — or a women's title when the player holds no open title |
w_title, o_title, foa |
string | women's title held alongside an open title; other titles (arbiter, trainer); FIDE Online Arena title |
std, rapid, blitz |
float32 | ratings (NaN when unrated — FIDE's 0 is stored as NaN) |
std_games, rapid_games, blitz_games |
float32 | rated games in the last period |
std_k, rapid_k, blitz_k |
float32 | the K-factor FIDE lists for the player |
birth_year |
float32 | birth year (98% present; implausible years are treated as missing in the book) |
flag |
string | i inactive, w woman, wi both, <NA> neither |
Quirks. "Active" in the book means a standard rating and no i in flag (223,908 players). The
lowest standard rating in the list is 1400 — FIDE's rating floor — so the list's median (1,699 for active
players) is not comparable with online medians. Kasparov appears (2812) but is inactive. The title column
holds the highest title in one field; count women's titles from both title and w_title.
B.8 puzzles — the Lichess puzzle database
Source. The Lichess puzzle database (CC0), downloaded November 2026. Loader:
chessdata.puzzles(theme=None, min_rating=None, max_rating=None).
| Column | Type | Meaning |
|---|---|---|
puzzle_id |
string | Lichess puzzle id |
fen |
string | the position before the opponent's move — the puzzle starts after moves[0] |
moves |
string | UCI moves: the opponent's setup move, then the solution (solver and opponent alternating) |
rating, rating_deviation |
int16 | Glicko-2 puzzle rating (399–3330, median 1411) and its uncertainty |
popularity, nb_plays |
int16, int32 | Lichess's popularity score (votes; at most 100, lowest in this file −83) and times played |
themes |
string | space-separated tags (fork, mateIn2, middlegame, … — 73 distinct tags) |
game_url |
string | the game the puzzle came from |
opening_tags |
string | opening names (20% of puzzles) |
DailyDate |
double | set only for the few puzzles that featured as "puzzle of the day" |
n_moves |
int16 | number of UCI moves in moves, including the setup move |
Quirks. The solver's number of moves is n_moves // 2 (a 2-move puzzle has n_moves = 4). Theme tags
are generated automatically by Lichess and a puzzle carries several; there is no overloading tag, so the
book's overload examples come from its own detector
(Chapter 9). Puzzle ratings live on
their own scale; do not compare them with game ratings.
B.9 game_features — one row per game, 78 columns
Source. Built by scripts/build_features.py, which replays every game that has move text — 864,816
Lichess games and 371,002 broadcast games (Standard, no set-up position) — with python-chess and the toolkit's
canonical definitions. Loader: chessdata.game_features(source=None).
{'lichess': 864816, 'broadcast': 371002}
lichess rows: 864816 | sum sample_weight: 4000445
lichess sample_weight values: {8.0: 447947, 1.0: 416869}
lichess complete evals (white_acpl present): 416848
broadcast rows: 371002 | complete evals: 322006
parse errors: 22
The columns, grouped:
| Group | Columns | Definition |
|---|---|---|
| Keys | source, game_id, parse_error |
lichess / broadcast; the error text if replay failed (22 broadcast games, e.g. castling typed with zeros) |
| Length | n_plies |
half-moves replayed |
| Castling | white_castle, black_castle (K/Q/<NA>), white_castle_ply, black_castle_ply, opposite_castling |
K = O-O, Q = O-O-O; ply of the castling move; both castled on different wings |
| Queens | queens_off_ply |
first ply after which neither side has a queen |
| Endgame | endgame_ply, endgame_signature, endgame_pawn_diff, endgame_piece_diff, pure_endgame_ply, ocb_entry, ocb_endgame |
first ply in a book endgame (non-pawn material of both sides ≤ 26); material signature (RB-RN) and White-minus-Black pawns / non-pawn material there; first queenless endgame ply; opposite-coloured bishops at entry / at any endgame ply |
| Structures | struct_20, struct_30, struct_40 |
;-joined structures.classify_structure labels at plies 20/30/40 ('' = none) |
| Pawn features | pf30_white_isolated … pf30_black_backward (8 columns) |
structures.pawn_features at ply 30 |
| Bishops | bishop_pair_40 |
at ply 40: white / black (only that side has both bishops), both, none |
| End | final_fen, final_signature, checkmate |
last position; its signature; the game ended in mate on the board |
| Clock | white_min_clock, black_min_clock |
lowest remaining clock (s) seen in [%clk] |
Evals (when every move has [%eval]) |
has_eval, white_acpl, white_accuracy, white_inacc, white_mist, white_blund, the same for Black, and *_acpl_{opening,middlegame,endgame}, *_acc_{…} |
the book's canonical CPL, accuracy and 5/10/15 win-% classification (Appendix D); phase = phase of the position before the move |
| Turning points | first_blunder_ply, first_blunder_side, decisive_ply |
first move losing ≥ 15 win-% points; first ply after which White's win % stays outside [10, 90] to the end |
| Metadata | eco, opening, result, white_elo, black_elo, speed, event, date, white_title, black_title, termination, avg_elo, rating_band, score_white |
copied from the source tables; rating_band uses Lichess ratings for Lichess rows and FIDE ratings for broadcast rows |
| Flags | engine_game, online (broadcast rows), lichess_analysed (Lichess rows) |
see quirk 2 |
| Weight | sample_weight |
8 for a Lichess game without server analysis (kept one in eight), otherwise 1 |
Quirks.
- Weights. Lichess rows sum to 4,000,445 when weighted — the four million games of the sample, up to the
rounding of systematic one-in-eight sampling. Any Lichess population estimate from this table must be
weighted:
(x * w).sum() / w.sum(). Statistics that need evaluations use the analysed games, which all have weight 1 — and are self-selected. - String-typed flags. In the parquet file
engine_game,online,lichess_analysedandocb_*are stored as the strings"True"and"False"(and<NA>for rows of the other source):
text
engine_game dtype when read directly: string values: {<NA>: 864816, 'False': 367123, 'True': 3879}
PITFALL broadcast engine_game.astype(object).astype(bool) -> True count: 371002 of 371002 (correct, .eq('True'): 3879 )
chessdata.game_features() engine_game dtype: boolean | True: 3879
Converting with .astype(bool) turns the non-empty string "False" into True, so every broadcast row looks
like an engine game and an "exclude engine games" filter silently drops all of them. On the full column
.astype(bool) fails outright (boolean value of NA is ambiguous). Use chessdata.game_features(), which
converts these columns to real booleans, or compare with .eq("True").
3. Per-phase columns can be missing even in analysed games: a game that never reaches an endgame has no
endgame ACPL (32% of rows have one).
4. Broadcast evals are relay evals of varying depth (B.5, quirk 6).
B.10 positions_sample — two hundred thousand positions
Source. Built by the same script: one random position from each sampled game, stratified by source ×
rating band × phase, with at most 4,070 positions per stratum. Loader: chessdata.positions_sample().
| Column | Type | Meaning |
|---|---|---|
source, game_id |
string, int64 | join to game_features |
ply |
int64 | plies played before this position |
fen |
string | the position |
phase |
string | book phase (opening, middlegame, endgame) |
eval_cp |
float | the stored [%eval] of this position (White POV; present for 66.7%) — Lichess server or relay engine, not the book's Stockfish |
white_elo, black_elo, avg_elo, rating_band |
ratings and band (Lichess ratings for Lichess rows, FIDE for broadcast rows) | |
result, speed, side_to_move |
string | |
sample_weight |
float | as in game_features |
stratum_weight |
float | how many games of the population each sampled position stands for within its stratum |
rows: 199986 {'lichess': 109890, 'broadcast': 90096} | eval present: 66.7
phase: {'middlegame': 67118, 'opening': 66666, 'endgame': 66202}
max stratum size: 4070
Quirks. Phases are sampled in equal numbers by design, so the raw table is one-third endgames. Re-weight with
stratum_weight × sample_weight to describe the population of positions — weighted, Lichess positions are 38.0%
opening, 44.5% middlegame and 17.5% endgame. The broadcast rows include engine and online events (the
sample has no flag column): join game_features on (source, game_id) and drop engine_game/online. Lichess
rows include some bot games; filter on the titles in game_features the same way.
B.11 Chess.com archives, and the three caches
data/cache/chesscom/{Hikaru,GothamChess}.parquet
Fetched through the Chess.com Published-Data API by chessdata.chesscom_archive(username), cached on disk.
Only two public accounts are in the snapshot; Magnus Carlsen's profile exists but its game archive returned
"not found" (404) and was not fetched.
Hikaru games 71786 | months 2014/01 -> 2026/11 | rules=chess 69411 | time_class {'blitz': 47384, 'bullet': 20940, 'rapid': 902, 'daily': 185} | with CAPS accuracy 52583
GothamChess games 34410 | months 2017/03 -> 2026/11 | rules=chess 33941 | time_class {'blitz': 19793, 'bullet': 13635, 'rapid': 494, 'daily': 19} | with CAPS accuracy 19684
| Column | Meaning |
|---|---|
username, month, url, end_time (UTC, timezone-aware) |
identification |
time_class (bullet/blitz/rapid/daily), time_control, rules, rated |
game type — rules includes chess960, oddschess, crazyhouse …; filter rules == "chess" |
white, black, white_rating, black_rating, white_result, black_result |
Chess.com's own Glicko-based ratings and result codes (win, checkmated, timeout, agreed, …) |
eco_url |
Chess.com opening page URL |
accuracy_white, accuracy_black |
Chess.com's own "Accuracy" (CAPS) — a proprietary number, not the book's accuracy |
pgn |
full PGN with [%clk] comments |
color, my_rating, opp_rating, my_result, score |
derived from the account's side |
retrieved |
download date (2026-11-20) |
Opening explorer cache (data/cache/explorer/)
chessdata.explorer(fen_or_moves, db="masters") queries the Lichess masters explorer (over-the-board games of
strong players) and stores the JSON with _retrieved and _url. All 108 cached answers were retrieved on
2026-11-20. The Lichess-games explorer (db="lichess") now needs a login token (LICHESS_TOKEN) and answers
401 without one, so the book uses its own lichess_games table instead. The explorer lists only the top moves
of a position; a move that is absent is "not listed", not "never played".
Tablebase cache (data/cache/tablebase.sqlite)
chessdata.tablebase(fen) asks the Lichess Syzygy server about positions with at most seven pieces and caches
the answer (2,509 probes when this appendix was written). The category is from the point of view of the
side to move (win, loss, draw, cursed-win, blessed-loss — the last two are wins and losses that
the 50-move rule turns into draws). dtz and dtm count plies. Each entry of moves[] carries a category
from the opponent's point of view after that move, so the best move for the side to move is listed with
loss:
tablebase KP vs K: draw
tablebase Ke6/Pe5 vs Ke8, White to move: win | best: Kd6 loss
Engine cache (data/cache/engine.sqlite)
Every evaluation made through toolkit/engine.py is stored under (position without move counters, depth,
number of lines, engine version) — 170,524 rows, all Stockfish 19, when this appendix was written. The first
search of a position stores its result; later calls return the identical numbers.
Repetition history and the cache. The two ways of calling the engine see different things:
engine.evaluate(fen)on a bare FEN gives Stockfish no history — it cannot know that the position has occurred before.engine.analyse_game(...)walks the game on one board and passes the move history to Stockfish. Stockfish then scores a repetition inside its search as a draw. In a sequence of checks or a piece shuffle that repeats positions, this can produce a spurious 0.00 for a position that is really winning for one side — and therefore false "blunders" and false critical moments on the moves around it.- The cache key is the position without history (placement, side to move, castling, en passant), so whichever
call evaluated a position first fixes its cached value: a 0.00 produced inside a repetition in one game is what
every later lookup of that position returns, in any game, and a history-free value stored first is what
analyse_gamegets back even when a repetition is on the board.
When a game contains repeated positions (perpetual-check attempts, repetitions before the time control), check
suspicious 0.00 evaluations and the "blunders" next to them with a fresh evaluate of the bare FEN at the same
depth, and treat the per-move labels there with caution (Appendix D, D.1).
B.12 The reference tables in data/reference/
Small, pre-computed tables that several chapters quote. Each was produced from the datasets above by a documented script; they exist so that a chapter can quote a number without re-running an hour of analysis.
| File | Rows × columns | Contents | Used in |
|---|---|---|---|
heatmaps_knights.csv, heatmaps_bishops.csv |
384 × 15 each | for each source (OTB / Lichess), colour and square: how often a knight (bishop) stands there at ply 30, frequency in wins/draws/losses, owner score, rating-adjusted score, win/loss ratio | Chapter 3 |
quiet_moves_sample.csv |
3,800 × 19 | 3,800 middlegame positions (400 per Lichess band + 600 OTB classical) with the played move, Stockfish 19 depth-16 best move, move kinds, evaluations, the null-move evaluation and the threat size | Chapter 7 |
puzzle_theme_stats.csv |
73 × 8 | every puzzle theme: count, median and quartile ratings, mean, share, kind (motif / phase / length / goal) | Chapter 9 |
puzzle_exemplars.csv |
39 × 9 | hand-checked example puzzles per motif (id, rating, popularity, solution, FEN, themes) | Chapters 9–11 |
distinct_positions_by_ply.csv |
80 × 6 | for N = 1 … 40 plies and each source: games reaching N plies, distinct positions, share of games in a position unique in the sample, share in the single most common position | Part IV (how quickly games leave known territory) |
champions_sf19_d16_games.csv |
1,438 × 10 | per game, per World Champion (18 champions × 40 sampled games, Euwe 39; champion and opponent rows): moves scored (moves 10–40), CPL sum, book accuracy, blunders, mistakes-or-worse, top-move matches, year | Chapter 29, Chapter 32 |
style_players.csv |
22 × 16 | style features of champions and modern elites: score, draw rate, game length, endgame reach, opposite castling, queens off by move 20, material-giving moves, sharpness with a 95% interval, sound sacrifices | Chapter 33 |
chess960_sf19_d20.csv |
960 × 8 | every Chess960 start position (Scharnagl number, back rank) with Stockfish 19 depth-20 evaluation, best move, line, nodes, depth | Chapter 37 |
chesscom_rating_curves.csv |
568 × 7 | monthly games, median and maximum rating and score for the two Chess.com accounts, by time class | Chapter 35 |
fide_age_curve.csv |
27 × 6 | active FIDE standard ratings by age bin: players, quartiles, 90th percentile | Chapter 25, Chapter 35 |
persona_dev.parquet |
600 × 28 | the composite "Dev": real Lichess blitz games of anonymous players rated 1550–1750 | Chapters 2, 20, 21, 23, 25 and others |
persona_lena.parquet |
300 × 28 | the composite "Lena": real Lichess rapid games of anonymous players rated 1300–1500 | Chapters 1, 8, 14, 25 |
persona_grace.parquet |
250 × 28 | the composite "Grace": real OTB classical broadcast games of unnamed players rated FIDE 1750–1950 | Chapters 20–24, 27 |
anchors/*.png |
17 images | the rendered diagrams of the book's four anchor examples | Chapters 2, 11, 20, 24 |
The three persona files share 28 columns: persona, persona_game_no, source, game_id, persona_color,
stratum, speed, time_control, persona_elo, opp_elo, white_elo, black_elo, result,
persona_score, elo_expected, eco, opening, family, termination, plies, has_eval, date,
utc_date, utc_time, event, base_s, inc_s, movetext.
🎭 Composite data: Dev's, Lena's and Grace's games are real games played by anonymous players at their rating, assembled by a fixed rule into one "player" so the book can demonstrate methods on "your own games". No number computed from them is a fact about a real person.
B.13 Toolkit reference: chessdata.py
chessdata is the data layer and the home of every canonical definition. Import it, never re-implement it:
if two chapters computed "accuracy" two ways, their numbers could not be compared.
import sys; sys.path.insert(0, r"C:\books\chess-analytics\toolkit") # or the standard header
import chessdata as cd, structures as st, engine as en, boards as bd
Constants
| Name | Value | Meaning |
|---|---|---|
PIECE_VALUES |
{"P": 1, "N": 3, "B": 3, "R": 5, "Q": 9} |
classical values in pawns |
EVAL_CLIP_CP |
1000 | every evaluation clipped to ±1000 cp; mate → ±1000 |
START_EVAL_CP |
20 | assumed White-POV evaluation before move 1 for [%eval] sequences (Lichess comments start after the first move) |
ENDGAME_MATERIAL_THRESHOLD |
26 | book endgame: combined non-pawn material ≤ 26 (the start has 62) |
OPENING_MAX_PLY |
20 | opening phase = first 20 plies (unless already an endgame) |
RATING_BANDS |
['<1000', '1000-1199', …, '2200-2399', '2400+'] |
band labels |
DATA_DIR, PROCESSED, CACHE |
paths | override the data location with the CHESSDATA_DIR environment variable |
Metrics and formulas (full definitions in Appendix D)
| Function | Returns |
|---|---|
expected_score(ra, rb) |
Elo expectation 1/(1+10^((rb−ra)/400)); vectorised |
elo_update(r, expected, actual, k=20) |
r + k·(actual − expected) |
performance_rating(opp_ratings, score, method="iterative", cap=800) |
"iterative" (exact logistic, by bisection; book default), "linear" (average + 400·(W−L)/n), "fide" (FIDE's dp table via 200√2·Φ⁻¹(p)); a 0% or 100% score returns average ∓/± cap |
eval_to_cp(cp, mate) |
one clipped centipawn number (mate → ±1000) |
win_pct(cp, mate=None) |
Lichess win % for the side whose view cp is from |
move_accuracy(wp_before, wp_after) |
Lichess per-move accuracy, 0–100 |
cpl(before, after) |
centipawn loss, mover's view, clipped |
classify_move(wp_drop) / classify_move_cp(cp_loss) |
inaccuracy/mistake/blunder/ok by 5/10/15 win-% points (book) or 50/100/300 cp (older alternative) |
per_move_metrics(evals_white_cp, start_cp=20) |
per-ply DataFrame: side, eval before/after, cpl, win % before/after, drop, accuracy, classification |
game_accuracy(x, side=None) / acpl(x, side=None) |
book game accuracy (mean of move accuracies) and ACPL — from a list of per-move values, or from White-POV evals with side= |
rating_band(r) / rating_bands(series) |
band label / ordered categorical |
speed_from_tc("180+2") |
Lichess speed class (seconds-based tags only) |
non_pawn_material(board, color=None), material(board, color) |
material sums |
phase_of(board, ply=None), is_pure_endgame(board, ply=None) |
book phase; endgame without queens |
material_signature(board) |
'RB-RN', 'Q-RR', 'KP-K' (White first) |
score(result, side) |
1 / 0.5 / 0 from a side's view |
expected_score(1700, 1500) = 0.7597
elo_update(1500, 0.36, 1, k=20) = 1512.8
performance_rating([2650,2700,2720], 2.5): {'iterative': 2971.2, 'linear': 2956.7, 'fide': 2963.6}
performance_rating([2000]*9, 6.5): {'iterative': 2166.0, 'linear': 2177.8, 'fide': 2166.7}
win_pct(0), win_pct(100), win_pct(-300), win_pct(None, mate=3): 50.0 59.1 24.89 97.54
move_accuracy(60, 50) = 63.58 | cpl(80, -40) = 120.0
classify_move(12) = mistake | classify_move_cp(120) = mistake
rating_band: ['<1000', '1000-1199', '1600-1799', '2200-2399', '2400+']
speed_from_tc: {'15+0': 'ultrabullet', '60+1': 'bullet', '180+2': 'blitz', '300+3': 'blitz', '600+5': 'rapid', '900+10': 'rapid', '1800+0': 'classical', '-': 'correspondence'}
phase_of(rook ending, ply 79): endgame | pure endgame: True | signature: R-R | non-pawn material: 10
phase_of(start, ply 0): opening | start non-pawn material: 62
score('1/2-1/2','black') = 0.5 | score('0-1','white') = 0.0
Move-text parsing
| Function | Returns |
|---|---|
parse_movetext(text) |
one dict per main-line ply: ply, san (with ?/! stripped), eval_cp (White POV, None if absent or mate), mate (signed, White POV), clock_s (remaining seconds after the move). Variations are skipped |
movetext_evals(plies) |
White-POV clipped evaluations (mate → ±1000; NaN when absent) |
iter_pgn_text(lines) |
fast PGN splitter yielding (headers, movetext) without python-chess |
count_plies(text), strip_comments(text) |
ply count; numbered SAN with comments, NAGs and variations removed |
mt = "1. e4 { [%eval 0.18] [%clk 0:03:00] } 1... c5 { [%eval 0.25] [%clk 0:03:00] } 2. Nf3?! { [%eval 0.1] [%clk 0:02:58] } 2... Qa5?? { [%eval #3] [%clk 0:02:55] } 1-0"
plies = cd.parse_movetext(mt)
print(pd.DataFrame(plies).to_string(index=False))
pm = cd.per_move_metrics([18, 25, 10, 1000], start_cp=cd.START_EVAL_CP)
print(pm.round(1).to_string(index=False))
ply san eval_cp mate clock_s
1 e4 18.0 NaN 180.0
2 c5 25.0 NaN 180.0
3 Nf3 10.0 NaN 178.0
4 Qa5 NaN 3.0 175.0
ply side eval_before eval_after cpl wp_before wp_after wp_drop accuracy classification
1 white 20.0 18.0 2.0 51.8 51.7 0.2 99.2 ok
2 black 18.0 25.0 7.0 48.3 47.7 0.6 97.2 ok
3 white 25.0 10.0 15.0 52.3 50.9 1.4 94.0 ok
4 black 10.0 1000.0 990.0 49.1 2.5 46.6 10.4 blunder
(The game is a made-up four-ply string to show the parser; #3 after 2...Qa5?? means White mates in three,
which becomes +1000 for White and a 46.6-point drop for Black.)
Loaders
| Function | Returns |
|---|---|
lichess_games(speed=None, min_elo=None, max_elo=None, balanced=None, exclude_bots=True) |
the Lichess table; min_elo/max_elo filter avg_elo; balanced=True keeps |diff| ≤ 100 (False keeps > 100); adds avg_elo, elo_diff, score_white |
is_bot_game(df) |
NA-safe boolean array: either side has the BOT title |
lichess_moves(game_ids=None) |
game_id, movetext (a parquet filter reads only the requested ids) |
lichess_eval_games(speed, min_elo, max_elo, balanced, limit=None, seed=0) |
analysed games merged with their move text; limit draws a reproducible random subset |
broadcast_games(variant="Standard", completed_only=True, speed=None) |
the broadcast table (filter engine_game and online yourself) |
broadcast_moves(game_ids=None) |
move text for broadcast games |
master_games(player=None) |
PGN Mentor games; player matches a collection name ("PolgarJ") or a substring of either name |
find_game(white, black, year, event, result, source="masters") |
matching rows with a pgn column (source="broadcast" assembles PGN from headers and move text) |
game_from_row(row) |
a chess.pgn.Game from a row's pgn (or movetext) |
fide_players(), puzzles(theme, min_rating, max_rating) |
as in B.7 and B.8 |
game_features(source=None) |
as in B.9, with the string flags converted to booleans |
positions_sample() |
as in B.10 |
lichess_games(blitz, 1800-2000 avg, balanced): 277389
mean size
eco
B01 0.506 14381
A40 0.517 14212
B00 0.523 12045
A00 0.512 11164
D00 0.540 10888
lichess_eval_games(rapid, limit=3): rows 3 | columns include movetext: True
broadcast_games(speed='classical'): 236806 | of which engine/online: 246 0
find_game Kasparov-Topalov 1999: game_id 53009 | ply 47 = Rxd4 | plies 87
find_game(..., source='broadcast') Carlsen-Praggnanandhaa rows: 1 | events: ['2026 Norway Chess Open']
puzzles(theme='fork', 1400-1600): 100582 | median n_moves: 6.0
positions_sample weighted phase shares (Lichess): {'endgame': 17.5, 'middlegame': 44.5, 'opening': 38.0}
Web sources (all cached — the book rebuilds offline)
| Function | Returns |
|---|---|
chesscom_archive(username, refresh=False) |
all public games of a Chess.com account (B.11) |
explorer(fen_or_moves, db="masters", ratings=None, speeds=None, refresh=False) |
Lichess opening-explorer JSON with _retrieved and _url; fen_or_moves is a FEN or a list of UCI moves |
tablebase(fen, refresh=False) |
Syzygy probe (≤ 7 pieces) with category, dtz, dtm, moves[] |
tablebase KP vs K: draw
tablebase Ke6/Pe5 vs Ke8, White to move: win | best: Kd6 loss
explorer masters, start: games 2997412 | retrieved 2026-11-20 | top moves: [('e4', 1368125), ('d4', 1070515), ('Nf3', 303299), ('c4', 206316)]
chesscom_archive('Hikaru'): 71786 | rules values: {'chess': 69411, 'chess960': 1026, 'oddschess': 829, 'crazyhouse': 170}
B.14 Toolkit reference: engine.py
Stockfish 19 with a persistent SQLite cache, returning the book's canonical metrics.
| Function | Purpose |
|---|---|
get_engine(threads=1, hash_mb=64) |
an Engine object; use as with get_engine() as eng: — methods .evaluate, .analyse_game, .new_game, .flush |
evaluate(fen, depth=18, multipv=1, engine=None) |
a dict — or a list of dicts when multipv > 1 — with rank, cp (White POV, None if mate), mate (White POV), pv (SAN list), pv_uci, depth, nodes, cp_clipped, win_pct_white. Terminal positions (mate, stalemate, insufficient material) are answered without the engine |
analyse_game(game_or_pgn, depth=16, engine=None) |
one row per ply: ply, move_no, side, san, uci, fen_before, eval_before, eval_after, mate_before, mate_after, best_move_san, best_pv, is_best, cpl, wp_before, wp_after, wp_drop, accuracy, classification, phase, clock_s, wp_white_after, depth |
critical_moments(df, n=3) |
the n moves with the largest win-% drops, in game order |
game_summary(df) |
per side: moves, ACPL, book accuracy, inaccuracies, mistakes, blunders |
analyse_games_parallel(pgns, depth=16, workers=None, hash_mb=32, progress=True) |
many games, one engine per worker process; failed games in result.attrs["errors"] |
engine_version() |
"Stockfish 19" |
evaluate(QGD position, depth=18): cp 43 | pv h3 a5 a3 Ne4 Bf4 Nd6 | depth 18
multipv=3: [('h3', 53), ('a3', 40), ('Rab1', 30)]
engine version: Stockfish 19
The two lines above evaluate the same position (the QGD Exchange of B.16) and illustrate the rule that single-line and multi-line searches can disagree: +0.43 with one line, +0.53 for the same best move in a three-line search. Quote one kind consistently and say which ("multipv 3").
Behaviour you should know.
- The cache key ignores move counters and history (see the repetition note in B.11), and
evaluateclears the engine's hash before every uncached single-position search, so results are reproducible.analyse_gameclears it once per game and walks the game in order. - A safety cap (
MAX_SEARCH_S = 120) stops a pathological search; the depth actually reached is stored indepth. - The engine-level
evaluate(..., fresh=False)buffers cache writes; if you build your own process pool, calleng.flush()before a worker exits, or the tail of its work is lost from the cache. - Mate scores at a fixed depth are not necessarily the shortest mate; state the depth when you quote "#N".
- Engine start-up can fail on a heavily loaded machine; the toolkit retries the handshake five times.
B.15 Toolkit reference: boards.py
Diagrams with matplotlib and DejaVu Sans chess glyphs.
| Function | Key arguments |
|---|---|
draw_board(board_or_fen, ax=None, flipped=False, arrows=None, highlights=None, heat=None, cmap=None, labels=True, title=None, pawns_only=False, caption=None, heat_values=False, heat_range=None, size=4.0, show_pieces=True, side_to_move=False) |
returns (fig, ax). arrows=[("e2","e4","green")]; highlights={"f7": "red"}; heat={sq: value} or an 8×8 array (diverging around 0: blue = White, orange = Black); pawns_only=True draws the skeleton |
save_board(path, board_or_fen, dpi=150, **kw) |
draw and save a 4-inch PNG (600 px) |
control_map(board) |
{square: White attackers − Black attackers} (direct attacks only; pinned pieces count; x-rays do not) |
draw_control_map(board, ax=None, values=True, **kw) |
the control map as a shaded board |
board_grid(fens, titles=None, ncols=3, size=2.6, **kw) |
several boards in a grid |
eval_graph(df, ax=None, critical=None, n_critical=3, title=None, label_moves=True) |
White's win % curve from analyse_game, critical moves labelled 24.Rxd4 |

📊 Figure (described):
draw_control_mapon the QGD Exchange position after 10...Nf8 (B.16). Each square shows White's attackers minus Black's: most of White's half is blue (+1 to +4), Black's camp is orange, and the square of Black's d5-pawn reads −2 — Black covers it two times more than White attacks it. A frontal assault on d5 gets nowhere, which is one way to see why White's standard plan in this structure is the minority attack on the queenside instead.
Named colours: green (plans), red (threats), blue, orange, yellow, or any matplotlib colour. One
known quirk: eval_graph on a slice of an analysis table still starts its x-axis at ply 0 — set the limits
afterwards with ax.set_xlim(...).
B.16 Toolkit reference: structures.py
Deterministic, pawn-only rules, so every structure statistic in the book is reproducible.
| Function | Returns |
|---|---|
classify_structure(board) |
list of "<Label>:<owner>" strings |
pawn_features(board) |
per side: pawns, doubled, isolated, backward, passed, islands |
king_shelter(board, color) |
0–3: files among king file ± 1 with an own pawn one or two squares in front of the king |
mobility(board, color) |
legal moves of color as if it were to move |
mobility_by_piece(board, color) |
legal-move counts by piece letter |
outposts(board, color) |
squares in the enemy half, defended by an own pawn, that no enemy pawn can ever attack |
occupied_outposts(board, color) |
knights and bishops standing on them |
has_bishop_pair(board, color), opposite_coloured_bishops(board) |
booleans |
space(board, color) |
the book's space count (Appendix D) |
The structure labels (owner = the side the structure is named for):
| Label | Rule (White as owner; colours reverse for Black) |
|---|---|
IQP |
d-pawn on d4/d5, no c- or e-pawns |
Hanging |
c4 + d4 side by side, no b- or e-pawns |
Carlsbad |
owner d4, no c-pawn, e-pawn on e2/e3; opponent d5, c-pawn on c6/c7, no e-pawn (QGD Exchange → Carlsbad:white) |
Maroczy |
c4 + e4, no d-pawn; opponent d6, no c-pawn |
Hedgehog |
Maroczy centre vs a6, b6, d6, e6 and no c-pawn |
FrenchChain |
d4 + e5 vs d5 + e6 |
KIDChain |
d5 + e4 vs d6 + e5 |
OpenSicilian |
owner has an e-pawn and no d-pawn; opponent has no c-pawn but d- and e-pawns (not when Maroczy) |
Stonewall |
c3, d4, e3, f4 |
SlavTriangle |
c3, d4, e3 without the Stonewall f-pawn |
QGD Exchange after 10...Nf8 - classify_structure: ['Carlsbad:white']
pawn_features: {'white': {'pawns': 7, 'doubled': 0, 'isolated': 0, 'backward': 0, 'passed': 0, 'islands': 2}, 'black': {'pawns': 7, 'doubled': 0, 'isolated': 0, 'backward': 0, 'passed': 0, 'islands': 2}}
king_shelter W/B: 3 3 | mobility W/B: 48 31
mobility_by_piece W: {'P': 9, 'N': 11, 'B': 12, 'R': 8, 'Q': 7, 'K': 1}
outposts W: [] | occupied: {'N': [], 'B': []}
space W/B: 9 9 | bishop pair W: True | OCB: False
control_map e5/c5/d5: 2 0 -2

♟️ Position: White Kg1, Qc2, Ra1, Rf1, Bd3, Bg5, Nc3, Nf3, a2, b2, f2, g2, h2, e3, d4; Black Kg8, Qd8, Ra8, Re8, Be7, Bc8, Nf6, Nf8, d5, c6, a7, b7, f7, g7, h7 — White to move. FEN:
r1bqrnk1/pp2bppp/2p2n2/3p2B1/3P4/2NBPN2/PPQ2PPP/R4RK1 w - - 9 11

📊 Figure (described):
save_board(..., pawns_only=True)keeps only the pawns (and faint kings): the Carlsbad skeleton of White d4/e3 against Black c6/d5 with no Black e-pawn — the structure whose plans Chapter 2 teaches.⚠️ Common pitfall: the
OpenSicilian:blacklabel. The rule is "owner has an e-pawn and no d-pawn, opponent has no c-pawn" — which also fits many Queen's Gambit, Catalan and English positions after ...dxc4. In the broadcast games, of 19,359 games carryingOpenSicilian:blackat ply 20, only 0.9% have a Sicilian ECO code (B20–B99); 48.4% are D-codes, 25.7% A-codes and 21.9% E-codes. (The White-owned label is genuinely Sicilian far more often: 64.3% of 42,076 games are B20–B99.) Never reportOpenSicilian:blacknumbers as Sicilian statistics without filtering by opening.
structures.space counts only relative ranks 2–6 (the enemy half contributes ranks 5–6 on files c–f), and
mobility counts legal moves, so a pinned piece contributes nothing.
B.17 The quirk checklist
Before you trust a number you computed from the snapshot, run down this list.
| # | Check | Why |
|---|---|---|
| 1 | Did I exclude bot games, with is_bot_game (not != "BOT")? |
20,948 bot games; the naive mask keeps 2,384 of 4,000,000 games |
| 2 | Did I weight Lichess rows from game_features / positions_sample? |
un-analysed games are kept one in eight (sample_weight = 8) |
| 3 | Are my Lichess engine numbers about analysed games only — and did I say so? | analysed games are self-selected (Appendix E) |
| 4 | Did I drop engine_game and online broadcast games, including in positions_sample? |
3,880 + 3,578 non-OTB games are in the relay data |
| 5 | Did I read engine_game/online as strings when reading the parquet directly? |
.astype(bool) turns "False" into True |
| 6 | Am I using speed, not the broadcast TimeControl tag? |
tags mix minutes and seconds |
| 7 | Do I need the nominal base time? | base_s usually includes the first increment (5,460 s for 90+30) |
| 8 | Is inc_s missing? |
missing for 35.7% of human OTB games |
| 9 | Did I filter OpenSicilian:black by ECO B20–B99? |
0.9% of such games are Sicilians |
| 10 | Did I name the rating pool and avoid converting between pools? | Glicko-2 online vs FIDE Elo vs Chess.com |
| 11 | Did find_game return exactly one row — the right one? |
first match wins |
| 12 | Did I state the engine depth and single-line vs multi-line? | evaluations differ by depth and search mode |
| 13 | For master games: could blitz, simul or blindfold games be in my sample? | PGN Mentor has no speed tag |
| 14 | Is Chess.com "accuracy" in my table CAPS, not the book's accuracy? | different, proprietary definition |
| 15 | Did I remember the window is 34 hours of one Thursday–Friday? | time-of-day and weekday skew |