summaryrefslogtreecommitdiff
path: root/src/eval_tune/lazy_eval_margins
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-18 09:43:17 -0700
committerScott Gasch <[email protected]>2026-09-18 09:43:17 -0700
commitf698c02de213d0ed8968fb7cca5f70df51fa0763 (patch)
tree080d6443fbe62d71de092f9acde61da387dff408 /src/eval_tune/lazy_eval_margins
parent4a7ec9ac91939957fb3d3e5564fc24a385b422ff (diff)
Redesign lazy/super-lazy eval margins with position-specific percentile
tables, and fix four real search/recognizer bugs found while validating it Main theme: replace the flat, heavily-padded LAZY_EVAL_BASE_MARGIN / SUPER_LAZY_MARGIN_BY_ARMY constants with per-material-bucket percentile tables (king safety by attacker army, residual by own army, separate tables for the lazy vs super-lazy baselines) derived from a 30k-position calibration pool, targeting a measured ~1-1.5% exceeded-margin rate instead of an unmeasured "add lots of headroom" floor. QSearch's FUTILITY_BASE_MARGIN_LAZY/SUPERLAZY were re-derived to match the new, now-meaningful (p50-based) iPositional this produces. Self-play confirms the working tree beats both HEAD, a more liberal (~5% miss target) variant, and a more conservative (near-zero miss) variant of the same margin mechanism. Along the way, an initial self-play regression (this margin work bundled with several changes in one pass, one of which broke things) led to a day of ZFS-snapshot bisection and then targeted DEBUG-build fuzzing against a stratified 200k-position corpus (tests/cross_sectional_200k.ep_, new), which is what actually found and fixed four distinct, real, pre-existing engine bugs -- none of them related to the margin redesign itself: - searchsup.c (CommonSearchInit): three early-return paths (timer abort, draw, too-deep bailout) left a node's own PV[] row stale instead of clearing it, letting an ancestor's UpdatePV splice a leftover move from a completely unrelated node into the displayed PV -- root cause of a WalkPV/MakeMove assert ("moving a piece to capture, but nothing was on the target square"). - dynamic.c (RecordEnprisePieceAtPly): the two-slot en-prise dedup compared (square, piece) instead of square alone, so a same-square re-record with a different piece (legitimate -- a fail-high capture's victim is restored by UnmakeMove and can differ across calls at the same ply) shifted a duplicate square into both slots, tripping ValueOfMaterialInTroubleDespiteMove's two-distinct-squares assert. - recogn.c (_RecognizeKBKP): the wrong-colored-bishop corner-fortress draw shortcut fired even when the weak side has its own pawn(s), which can hand the strong side real zugzwang resources the fortress logic doesn't account for -- produced a false hard draw bound where EGTB shows a near-forced loss. - eval.c (_EvalPasserRacesAgainstLoneKings): a rook pawn's race was credited as winning even when the strong side's own king sits exactly on its own pawn's queening square (distance 0 specifically -- adjacent is fine, the square is empty) -- a classic stalemate resource the race heuristic can't see. Only reachable through _RecognizeKPK's pawn-hash-cache-hit path, which is why testrecogn.c's TestRecognExhaustiveKPK reported "0 wrong" the whole time; extended it to cover both color assignments and the full board (no mirror-shortcut) and documented the remaining cache-hit coverage gap for a future session to close. Also: match_play.py gains a local_ebf metric (geometric-mean of depth-normalized node-growth ratios between consecutive completed iterations) alongside the existing cumulative nodes**(1/depth) ebf, which turned out to be misleading when comparing engines with different lazy-exit aggressiveness -- and probe.c/hash.c pick up two small, independently-found correctness fixes (TB root-probe promotion piece missing its color bit; ASSERT(g_pHashTable) crashing on the legitimate "--hash none" config) noticed along the way. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/eval_tune/lazy_eval_margins')
-rw-r--r--src/eval_tune/lazy_eval_margins/README.md194
-rw-r--r--src/eval_tune/lazy_eval_margins/aggregate_marginsafety_shards.py92
-rw-r--r--src/eval_tune/lazy_eval_margins/hist_percentile.py86
-rw-r--r--src/eval_tune/lazy_eval_margins/residual_raw_histograms_guess2_30k.txt26
4 files changed, 398 insertions, 0 deletions
diff --git a/src/eval_tune/lazy_eval_margins/README.md b/src/eval_tune/lazy_eval_margins/README.md
new file mode 100644
index 0000000..239bb26
--- /dev/null
+++ b/src/eval_tune/lazy_eval_margins/README.md
@@ -0,0 +1,194 @@
+# Lazy/super-lazy eval margin redesign (2026-09-17)
+
+## What changed and why
+
+Original goal: speed up `Eval()` (eval.c) by letting more nodes exit
+through the cheap "super lazy" (material-only, runs before `_EvalPawns`)
+and "lazy" (material + pawns + passers + bad-trade + bishop-pairs) tiers
+instead of paying for full eval, motivated by comparing against Crafty's
+much higher NPS.
+
+The old margin construction (still visible via `git show HEAD:src/eval.c`
+at commit `4a7ec9a`) was a patchwork: a flat `LAZY_EVAL_BASE_MARGIN` (75)
+seed, widened by a `CountKingSafetyDefects`-indexed king term (`_EvalKing`'s
+own slow bitboard scan, called *again* just to estimate a margin) plus a
+flat residual constant, then `MAX()`'d against a separately-measured
+flat floor per material bucket. Super-lazy was a single flat
+`SUPER_LAZY_MARGIN_BY_ARMY[8]` lookup, no per-position information at all.
+Both had real problems: `CountKingSafetyDefects` is slow despite being
+bitboard-based (defeats the point of being in the *cheap* path), and the
+`MAX()`-against-a-flat-floor pattern silently overrode the
+position-specific estimate in most cases (found and fixed twice this
+session, once per tier).
+
+## The new construction
+
+For **both** tiers, at every node, cheap **O(1) table lookups only** (no
+`CountKingSafetyDefects`, no attack-table generation):
+
+```
+margin_a = MAX0( (king_p_hi[my_bucket] - king_p_lo[opp_bucket])
+ + (resid_p_hi[opp_bucket] - resid_p_lo[my_bucket]) )
+margin_b = MAX0( (king_p_hi[opp_bucket] - king_p_lo[my_bucket])
+ + (resid_p_hi[my_bucket] - resid_p_lo[opp_bucket]) )
+```
+
+- `margin_a` gates the fail-high check (`score - margin_a > beta`):
+ soundness requires assuming the most pessimistic-for-me,
+ optimistic-for-opponent outcome for each term.
+- `margin_b` gates the fail-low check (`score + margin_b < alpha`):
+ the mirror image.
+- **King term**: bucketed by the **attacker's** own army scaler
+ (`MINU(7, armyScaler/4)`, 8 buckets, 0-31 scaler range) -- danger to a
+ king is a function of the attacker's material, not the king-owner's.
+ Shared between both tiers (`iKingP2ByAttackerArmyOnly` /
+ `iKingP98ByAttackerArmyOnly` in eval.c).
+- **Residual term** (mobility/trapped/passers-not-yet-counted/etc.):
+ bucketed by **each side's own** army scaler. Two separate tables
+ because the two tiers have different baselines to estimate *from*:
+ - `iResidualP2/98ByOwnArmy` -- regular lazy's baseline already
+ includes pawns/passers/bad-trade/bishop-pairs, so this residual
+ only needs to cover what's left (mobility, trapped pieces, etc).
+ - `iSuperLazyResidualP2/98ByOwnArmy` -- super-lazy's baseline is pure
+ material, so this residual is much wider (includes everything
+ regular lazy's own residual excludes).
+
+`_hi`/`_lo` are currently p98/p2 as shipped, but genuinely **per-bucket
+tunable** -- see "How to keep tuning" below. The king table has very
+little spread above p90 in every bucket (already checked against the
+full histogram) and was deliberately left alone throughout tuning;
+all of today's percentile-adjustment work only ever touched the two
+residual tables.
+
+`iPositional[side]` (the value fed back to QSearch's futility pruning,
+`search.c`'s `FUTILITY_BASE_MARGIN_BY_SOURCE[tier] + iPositional[side]`)
+is now a **separate**, deliberately different statistic: a **p50**
+(median, not tail-bound) typical-value estimate of that side's own
+missing terms, matching what full-eval's own `iPositional` actually is
+(a real point estimate, not a safety margin). See `iKingP50By...` /
+`iResidualP50By...` / `iSuperLazyResidualP50By...` in eval.c. Don't
+confuse these with the p98/p2 margin tables -- different statistic,
+different purpose (bias correction vs. soundness bound).
+
+## Where the histogram data lives
+
+`eval.c`'s `_PersistRawHistogramsToFile()` (called automatically every
+time a `DUMP_RESIDUAL_SAMPLES` build runs `calibrate residual`) writes
+**every raw bin** of all three histograms (residual, sl_residual, king)
+to `/var/tmp/typhoon/residual_raw_histograms.txt` -- not just the
+handful of percentile columns that happen to be printed to the console.
+This directory (`src/eval_tune/lazy_eval_margins/`) has copies from the
+2026-09-17 "guess #2" 30k-position calibration run
+(`residual_raw_histograms_guess2_30k.txt`) plus the reader script
+(`hist_percentile.py`) -- **copy the fresh file here after any future
+30k run you want to keep**, since `/var/tmp` is scratch and could be
+cleared.
+
+To read *any* percentile out of a saved histogram, without re-running
+anything:
+
+```sh
+python3 hist_percentile.py residual_raw_histograms_guess2_30k.txt # default spread
+python3 hist_percentile.py residual_raw_histograms_guess2_30k.txt 0.93 0.965 # exact percentiles you want
+```
+
+## How to keep tuning
+
+1. **Build**: `gmake clean && gmake -j5 GENETIC=1 PERF_COUNTERS=1 MP=1 SIXTYFOUR=1 DUMP_RESIDUAL_SAMPLES=1 CALIBRATE_MARGIN_SAFETY=1`
+2. **Run the 30k stratified pool** (both commands in one invocation --
+ `calibrate residual` persists the histogram file, `calibrate
+ marginsafety` prints the real exceeded rate per **material** bucket
+ for both tiers):
+ ```sh
+ ./typhoon --cpus 1 --hash 256m --logfile /var/tmp/typhoon/run.log \
+ --batch --command "force; book name /nonexistent.book.bin; sd 6; \
+ script ../tests/eval_calibration_sample_strat30k.ep_; \
+ calibrate residual; calibrate marginsafety" \
+ > /var/tmp/typhoon/run.stdout 2>&1
+ ```
+ Takes roughly 20-25 minutes. Run it in the background
+ (`run_in_background`/`&`), don't block on it.
+3. **Read the exceeded rate per material bucket** from the
+ `calibrate marginsafety` output (`exceeded / n`, printed separately
+ for "Regular lazy" and "Super lazy", by **material** bucket --
+ combined army scaler / 8, a *different* bucketing than the
+ percentile tables' per-side scaler/4 buckets -- see the caveat
+ below).
+4. **Copy the fresh `/var/tmp/typhoon/residual_raw_histograms.txt`**
+ into this directory before it can get lost.
+5. **Pick new percentiles per per-side bucket** using
+ `hist_percentile.py` against the fresh file, and edit
+ `iResidualP2/98ByOwnArmy` / `iSuperLazyResidualP2/98ByOwnArmy` in
+ eval.c directly (keep each bucket's low/high pair **symmetric** --
+ e.g. p95/p5 together, never p98 mixed with p10 in the same bucket).
+6. **Rebuild and re-run step 2** to verify the real effect.
+
+### The two gotchas that cost real time this session
+
+- **The 500-position "quick check" sample is unreliable for this
+ specific measurement.** It's fine for cheap direction-of-travel
+ checks on most things, but exceeded-rate is a rare-event percentage,
+ and 500 positions (not even 500 independent draws -- a single game's
+ search tree can dominate a material bucket's node count) can be off
+ by 2-5x from the true 30k-pool rate. One bucket (super-lazy material
+ bucket 1) got tightened based on a 500-position reading of 0.035%,
+ then the real 30k number came back at 1.13% -- a dangerous-direction
+ miss. **Always confirm with the full 30k pool before trusting a
+ number**, especially anything under ~1%.
+- **Changing one bucket's margin changes measured behavior in OTHER
+ buckets too**, even ones whose own table entries never moved. This
+ isn't a bug -- `Eval()`'s exit decisions are real search behavior, so
+ widening/narrowing any margin reshapes the actual search tree
+ (different alpha/beta bounds propagate differently), which changes
+ which exact nodes land in *every* material bucket, not just the one
+ you touched. Material bucket 3's exceeded rate moved from 0.21% to
+ 0.94% to 0.65% to 1.44% across different runs despite its own table
+ entries never changing once. Don't chase a bucket that "moved" if you
+ didn't touch its inputs -- check what else changed first.
+- **Material buckets and per-side buckets are different bucketing
+ schemes.** `calibrate marginsafety` reports by **material bucket**
+ (`_MaterialBucket`: combined army scaler for both sides, /8). The
+ percentile tables you actually edit are indexed by **per-side**
+ bucket (`armyScaler/4`, one bucket per side, looked up twice -- once
+ as "my bucket", once as "opponent's bucket"). A single material
+ bucket (e.g. combined scaler 24-31) is populated by many different
+ per-side bucket combinations (3+4, 2+5, 1+6, 0+7...), so there's no
+ clean 1:1 way to "fix material bucket 3" by editing "per-side bucket
+ 3" alone -- expect diffuse, imprecise control, not a dial.
+
+## On the "insane" 2% idea
+
+Structurally straightforward: pick a looser matched percentile pair
+(e.g. p90/p10, or go outside the currently-recorded columns using
+`hist_percentile.py` against a fresh histogram) for whichever buckets
+you want at ~2%, following the same edit-rebuild-reverify loop above.
+Two things worth checking once you have it:
+
+1. **NPS gain isn't guaranteed to scale linearly with the exceeded-rate
+ relaxation** -- this session found the NPS win from the whole
+ redesign was much smaller than expected (see the `git log`/session
+ history around `EvalLookForDrawishSituations` getting added to both
+ cheap tiers, and `fBareKingEitherSide`'s two unconditional
+ `TotalNonPawnCount` calls on every node -- both are new fixed costs
+ that eat into any margin-driven exit-rate gain). Worth re-checking
+ the `Eval exit breakdown` / new `calibrate exitrate` numbers
+ (below) alongside NPS, not just NPS alone.
+2. **`FUTILITY_BASE_MARGIN_LAZY`/`SUPERLAZY`** (search.c/chess.h) were
+ calibrated against *this* `iPositional` distribution
+ (`CALIBRATE_QSEARCH_FUTILITY`, see chess.h's derivation comment near
+ those two `#define`s) -- if the eval-exit margins move a lot, especially
+ in a direction that changes how often/how confidently each tier
+ exits, it's worth re-running that calibration too rather than
+ assuming the existing 350/175 values still hold.
+
+## New tooling added this session (always available, no build flag)
+
+- **`calibrate exitrate`** -- prints eval exit rate (% super lazy / %
+ lazy / % full) **by material bucket**, not just the flat aggregate
+ "Eval exit breakdown" line every search already prints. Complements
+ the exceeded-rate data: a bucket with low exit rate AND low exceeded
+ rate has real untapped speed headroom; a bucket already near its
+ target exceeded rate with a healthy exit rate is well-calibrated.
+ Implemented in eval.c (`g_u64SuperLazyEvalsByBucket` /
+ `g_u64LazyEvalsByBucket` / `g_u64FullEvalsByBucket`,
+ `DumpEvalExitRateByBucket`) and wired into command.c.
diff --git a/src/eval_tune/lazy_eval_margins/aggregate_marginsafety_shards.py b/src/eval_tune/lazy_eval_margins/aggregate_marginsafety_shards.py
new file mode 100644
index 0000000..69e5c8e
--- /dev/null
+++ b/src/eval_tune/lazy_eval_margins/aggregate_marginsafety_shards.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python3
+"""Combine N shards' persisted raw swing histograms (eval.c's
+PersistMarginSafetyHistogramsToFile, "calibrate marginsafety <path>")
+into one true aggregate: sum count/exceeded/sum/sumSq/histogram bins
+bucket-by-bucket across all shard files, then recompute mean/stdev/
+percentiles from the combined totals. Percentiles/means from
+individual shards can't be validly averaged -- this reads raw counts
+only and derives every statistic fresh from the combined totals.
+
+Usage:
+ python3 aggregate_marginsafety_shards.py <shard_file> [<shard_file> ...]
+"""
+import sys
+from collections import defaultdict
+
+BIN_WIDTH = 10
+
+
+def load(path):
+ """Yield (tier, bucket, count, exceeded, sum_, sumsq, max_, bins)."""
+ with open(path) as f:
+ for line in f:
+ if line.startswith('#') or not line.strip():
+ continue
+ parts = line.split()
+ tier, bucket = parts[0], int(parts[1])
+ count, exceeded, sum_, sumsq, max_ = map(int, parts[2:7])
+ bins = list(map(int, parts[7:]))
+ yield tier, bucket, count, exceeded, sum_, sumsq, max_, bins
+
+
+def percentile(bins, total, p):
+ target = p * total
+ running = 0
+ for i, c in enumerate(bins):
+ running += c
+ if running >= target:
+ return i * BIN_WIDTH + BIN_WIDTH // 2
+ return (len(bins) - 1) * BIN_WIDTH
+
+
+def main():
+ if len(sys.argv) < 2:
+ print(__doc__)
+ sys.exit(1)
+
+ agg = defaultdict(lambda: {"count": 0, "exceeded": 0, "sum": 0,
+ "sumsq": 0, "max": 0})
+ agg_bins = {}
+
+ for path in sys.argv[1:]:
+ for tier, bucket, count, exceeded, sum_, sumsq, max_, bins in load(path):
+ key = (tier, bucket)
+ a = agg[key]
+ a["count"] += count
+ a["exceeded"] += exceeded
+ a["sum"] += sum_
+ a["sumsq"] += sumsq
+ a["max"] = max(a["max"], max_)
+ if key not in agg_bins:
+ agg_bins[key] = bins[:]
+ else:
+ for i, c in enumerate(bins):
+ agg_bins[key][i] += c
+
+ for tier in ("lazy", "superlazy"):
+ print(f"--- {tier} ---")
+ for bucket in range(8):
+ key = (tier, bucket)
+ if key not in agg:
+ continue
+ a = agg[key]
+ n = a["count"]
+ if n == 0:
+ print(f" bucket {bucket}: no exits taken")
+ continue
+ mean = a["sum"] / n
+ variance = max(0.0, a["sumsq"] / n - mean * mean)
+ stdev = variance ** 0.5
+ pct = 100.0 * a["exceeded"] / n
+ bins = agg_bins[key]
+ p10 = percentile(bins, n, 0.10)
+ p50 = percentile(bins, n, 0.50)
+ p90 = percentile(bins, n, 0.90)
+ p99 = percentile(bins, n, 0.99)
+ print(f" bucket {bucket}: n={n} exceeded={a['exceeded']} "
+ f"({pct:.3f}%) max={a['max']} avg={mean:.1f} "
+ f"stdev={stdev:.1f} p10={p10} p50={p50} p90={p90} p99={p99}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/eval_tune/lazy_eval_margins/hist_percentile.py b/src/eval_tune/lazy_eval_margins/hist_percentile.py
new file mode 100644
index 0000000..bd90444
--- /dev/null
+++ b/src/eval_tune/lazy_eval_margins/hist_percentile.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python3
+"""
+Read any percentile out of the raw lazy/super-lazy-eval histograms
+persisted by eval.c's _PersistRawHistogramsToFile (called automatically
+every time a DUMP_RESIDUAL_SAMPLES build runs `calibrate residual`).
+
+Usage:
+ python3 hist_percentile.py <histograms_file> [percentiles...]
+
+ python3 hist_percentile.py residual_raw_histograms_guess2_30k.txt
+ python3 hist_percentile.py residual_raw_histograms_guess2_30k.txt 0.93 0.97 0.985
+
+With no percentile arguments, prints a default useful spread for every
+bucket of all three histograms (residual, sl_residual, king). With
+percentile arguments (0.0-1.0), prints just those, letting you probe
+any exact percentile the fixed comment-block charts in eval.c didn't
+happen to include -- no re-running the 30k pool required, as long as
+this file (or a fresher one) still exists.
+
+File format (one line per histogram/bucket):
+ <name> <bucket 0-7> <min> <max> <bin0-count> <bin1-count> ... <binN-1-count>
+Bin i covers [RESID_HIST_MIN + i*RESID_HIST_BIN_WIDTH,
+ RESID_HIST_MIN + (i+1)*RESID_HIST_BIN_WIDTH).
+These constants are echoed in the file's own header comment and also
+hardcoded below (must match eval.c's #defines -- they haven't changed
+since this was built, but check if eval.c's RESID_HIST_* macros ever
+do).
+"""
+import sys
+
+BIN_WIDTH = 20
+MIN_VAL = -900
+DEFAULT_PERCENTILES = [0.01, 0.02, 0.05, 0.10, 0.15, 0.50,
+ 0.85, 0.90, 0.95, 0.98, 0.99]
+
+
+def load(path):
+ hists = {}
+ with open(path) as f:
+ for line in f:
+ if line.startswith('#') or not line.strip():
+ continue
+ parts = line.split()
+ name, bucket = parts[0], int(parts[1])
+ mn, mx = int(parts[2]), int(parts[3])
+ bins = list(map(int, parts[4:]))
+ hists[(name, bucket)] = (mn, mx, bins)
+ return hists
+
+
+def percentile(bins, total, p):
+ target = p * total
+ running = 0
+ for i, c in enumerate(bins):
+ running += c
+ if running >= target:
+ return MIN_VAL + i * BIN_WIDTH + BIN_WIDTH // 2
+ return MIN_VAL + len(bins) * BIN_WIDTH
+
+
+def main():
+ if len(sys.argv) < 2:
+ print(__doc__)
+ sys.exit(1)
+ path = sys.argv[1]
+ percentiles = [float(x) for x in sys.argv[2:]] or DEFAULT_PERCENTILES
+
+ hists = load(path)
+ names = sorted(set(name for name, _ in hists.keys()))
+ for name in names:
+ print(f"--- {name} ---")
+ for b in range(8):
+ if (name, b) not in hists:
+ continue
+ mn, mx, bins = hists[(name, b)]
+ total = sum(bins)
+ if total == 0:
+ print(f" bucket {b}: no samples")
+ continue
+ vals = " ".join(f"p{p*100:g}={percentile(bins, total, p)}"
+ for p in percentiles)
+ print(f" bucket {b}: n={total} min={mn} {vals} max={mx}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/eval_tune/lazy_eval_margins/residual_raw_histograms_guess2_30k.txt b/src/eval_tune/lazy_eval_margins/residual_raw_histograms_guess2_30k.txt
new file mode 100644
index 0000000..2b986fd
--- /dev/null
+++ b/src/eval_tune/lazy_eval_margins/residual_raw_histograms_guess2_30k.txt
@@ -0,0 +1,26 @@
+# RESID_HIST_BINS=90 RESID_HIST_BIN_WIDTH=20 RESID_HIST_MIN=-900
+# format: <histogram> <bucket> <min> <max> <bin0> <bin1> ... <binN-1>
+residual 0 -144 767 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 15 164 1363 26504 174479 870508 9266911 49119730 10195507 9392713 9036132 4277890 3487761 2369088 1537274 999863 733265 510947 325044 214567 159847 115810 75069 48198 53969 37634 17605 11800 13104 10928 6699 4315 1992 702 497 596 343 115 133 43 5 6 7 3 0 5 0 0 0 0 0 0
+residual 1 -156 817 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 44 510 2519 27653 88357 885128 6171719 17661445 21810645 17631977 17341084 11832862 7552148 6791430 4867074 3212050 2748617 1753842 1210171 1050324 619975 429316 296650 188513 141398 94497 77357 66118 48128 33631 28220 22011 16774 6674 4299 2332 2356 728 258 129 118 114 65 105 178 90 12 6 0 0 0 0
+residual 2 -183 767 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 39 298 1221 7993 62272 318787 1469893 6092481 18509685 37928483 55472424 40013831 25427921 16592110 10713766 7338910 5431623 3411498 2200485 1762575 1326601 917085 652040 541064 448084 316076 207264 141942 100658 72110 46937 32947 29716 21672 11431 8430 4380 2749 3811 4795 2881 1284 371 81 46 21 14 4 0 0 0 0 0 0
+residual 3 -210 708 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 11 102 778 7487 39369 185878 803334 2696551 7792351 17127020 31285590 43472163 35858955 18973011 11014510 7015793 4092753 2517064 1766213 1251219 892795 649846 465365 307463 220300 150647 108576 70034 54041 44466 24664 16116 8143 3820 2821 2969 2367 898 456 277 314 294 49 4 0 2 0 0 0 0 0 0 0 0 0
+residual 4 -225 735 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 26 355 2543 11604 72812 290938 1156430 4063826 9580273 17459580 27571067 37693079 41349983 32425962 19576659 10348483 5596569 3020560 1769703 1054860 663900 408572 251828 160650 111173 70030 48591 34664 28081 18251 10057 6322 4553 3129 2430 2085 1623 1246 648 227 136 107 37 7 11 3 1 3 0 0 0 0 0 0 0 0
+residual 5 -225 728 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 41 259 1047 6877 35991 215344 954842 2475083 5520028 11787046 23343313 36563338 41059148 31171892 17495367 8653512 4388935 2295381 1170946 613945 327609 182686 94836 58512 33370 22357 14125 7054 4429 2678 1824 1213 693 540 262 225 210 92 45 40 20 14 0 2 3 6 0 1 0 0 0 0 0 0 0 0
+residual 6 -224 760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 25 193 1633 11244 59390 297180 1126668 3332277 7944759 14947141 23012354 27606104 25076655 16782590 8821595 4172757 2073401 1032648 497320 231717 113521 48847 25571 13957 9194 5013 3337 2048 763 658 376 369 399 182 156 158 100 54 30 56 35 30 11 5 0 2 0 0 0 1 0 0 0 0 0 0
+residual 7 -256 796 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 77 596 5373 33876 182971 1124882 5159235 14160661 23154137 28288490 27723692 24273561 18434696 11921382 6003346 2701510 1202658 564453 271480 120240 46627 25543 12741 6227 4692 3975 3596 2684 2263 2613 2155 1532 1027 1047 1954 2956 4217 2730 2126 967 332 208 116 73 24 31 16 8 4 8 1 2 0 0 0 0 0
+sl_residual 0 -363 2383 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 93 484 640 153 944 6091 20107 51368 43682 61452 73815 450532 1070740 1185017 1377715 1882895 6976318 18555405 16351680 6913999 5535807 6075056 5768506 5203691 4766197 3607623 2891038 2201502 1963000 1754691 1432133 1186087 971353 821438 589362 472728 426170 328019 262892 212348 175548 135083 114599 93897 72212 54737 41617 37979 29664 24002 15597 12435 12510 8346 6653 5274 4019 4598 3301 2277 2236 2950 746847
+sl_residual 1 -350 2456 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 5 12 209 154 212 1274 12139 17551 47595 38725 102721 275278 539485 924729 1517142 3059707 6915457 10963773 11809407 12944977 11134953 8917513 6063037 6607549 6690745 6033403 4709770 3464565 3120172 3067544 2518393 2152774 1875512 1409464 1171932 1008477 819500 684053 565223 450984 357881 297513 245308 193249 151350 115055 97969 79972 58946 51025 47163 37878 31393 29576 22418 16450 11622 7403 6610 4681 3334 1216751
+sl_residual 2 -341 2226 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 20 208 396 602 1065 5506 13385 39278 61658 95967 234519 537941 1151958 2189188 4202147 8406507 16076015 23816608 26868181 22293821 17876248 15042703 14417036 14403728 13616478 11421449 8195783 5804731 4559679 4050663 3497138 3025192 2548203 2088973 1766790 1506917 1243835 1005108 812946 678053 562124 499853 407287 313262 244722 202921 178275 143852 116515 86324 76908 71566 46813 32523 27196 25513 20425 15831 11815 9744 8976 991720
+sl_residual 3 -311 2183 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 21 61 154 542 1617 6306 18634 57796 137250 340158 813627 1900843 3798631 7183830 12657185 18955192 21399463 18622591 15039544 13069881 12002181 11690756 11082693 9079555 6607407 4844608 3632648 2812063 2286639 1952744 1628981 1325755 1088511 902859 716353 593121 507472 394467 286453 226564 184610 158212 129615 86332 75782 62737 49833 35072 29724 26078 19926 9245 7706 5500 4922 3131 3186 2083 1118 366910
+sl_residual 4 -332 1946 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 21 80 211 622 3216 7794 32108 85027 225564 575581 1288954 3162189 6503748 11524536 18055696 23379479 24854534 22254347 18468757 15612518 13595561 12248658 10461509 8232521 5973240 4332984 3091915 2436182 1930237 1434378 1046871 880613 710435 546475 437304 349561 246922 199709 151603 109361 79442 59223 45107 34391 31970 22142 15522 9573 9427 8249 7055 5312 2786 2100 2159 1781 1156 769 677 83810
+sl_residual 5 -255 1959 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 57 329 4118 5157 14547 53072 161291 460439 1366767 3711631 8379895 15114309 21009055 22617644 20719402 17623487 15520726 14438771 12605962 9666895 7026907 4848987 3389235 2392977 1724454 1361809 1038860 801316 631963 463280 347886 252687 203077 147415 112983 79834 51836 36878 26805 24492 15956 9257 7965 7546 4340 2921 2696 1937 1309 1570 558 619 572 317 501 410 9468
+sl_residual 6 -322 1921 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 10 71 75 533 2537 11871 45926 131486 411320 1022733 2455401 5155972 9050806 13534299 16064085 16289462 15246951 13506364 11485469 9336040 7270302 5223679 3423875 2232509 1548254 1085937 748196 537179 397751 283388 198894 143374 115014 84269 62144 41887 31983 20610 16322 8934 6864 4099 2740 1912 1078 897 984 861 495 349 232 220 168 174 1281 152 167 187 3754
+sl_residual 7 -290 2039 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 31 121 586 1390 5878 24253 78844 278500 840574 2421193 6465722 13171899 20355153 24186909 23376822 20790625 16475246 12347211 8814924 5940613 3741540 2250945 1341224 835775 536221 375668 245355 159741 114766 70869 52534 35541 27512 20952 14552 8525 6352 4366 3373 1674 1291 964 1139 1439 1256 1046 786 2036 1771 1237 1465 545 193 198 343 553 394 248 18929
+king 0 -68 181 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 69 13211 207523 934645 86648386 13071969 1298059 789094 81956 47100 5587 1482 69 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 1 0 161 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 108064710 13984126 1444075 1033373 138118 49190 4019 2051 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 2 -89 162 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1722 114112 2065803 15570929 85638651 125730930 7266574 838747 361815 45770 15105 279 350 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 3 -176 137 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1661 19108 103023 459746 1201670 4330223 13600383 37139535 114485792 17300124 199194 64499 16526 4483 884 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 4 -307 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 407 4859 24035 132051 369749 1106700 1918977 3315303 3740907 4954043 7287145 13988322 25447798 39536019 49741182 59441529 3861220 2098 608 489 235 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 5 -354 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5827 43950 125055 504347 1037805 1783337 2511730 2350938 1689828 2132156 5231247 11219252 16784636 15952530 32037510 44817856 36448686 12878906 949585 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 6 -401 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5868 21230 53145 247683 406957 618270 890299 1239517 639988 477285 1587414 3082228 6139626 10016755 5146310 20237958 24080439 40947637 12534859 7979863 899195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+king 7 -394 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2363 7209 17894 78444 122463 206455 294717 391409 200453 202923 629244 1181690 2913486 5469013 3799599 16806699 19832913 50537919 22693260 38337669 1733993 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0