feat(heatmap): board overlay for next-move frequencies#26
Closed
atamano wants to merge 1 commit into
Closed
Conversation
Co-Authored-By: Jeff Palmer <jeff@jeffpalm.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
Owner
Author
|
Closing for now — putting the heatmap on pause. Branch and work stay put; can reopen later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Takes over #18 (Jeff Palmer's heatmap overlay) and reworks it to fit the architecture and clear the blocking bugs found in review. The feature, the styling, and the full 13-locale i18n are Jeff's; this branch keeps them and rebuilds the data path underneath.
Closes #18. Co-authored with @jeffpalm.
What the feature does
A "Heatmap" toggle by the board's Export button. On, every candidate next move at the current position tints its destination square cold-to-hot by how often it was played, with the opening name, share %, and game count on the square.
What changed from #18
Collision bug — was dropping games (blocking). The overlay keyed cells by destination square and, when two moves shared one (
Nf3/f3from the very first move,Rae1/Rfe1later), kept only the most-played and silently discarded the other's games, so shares no longer summed to 100%. Squares now aggregate every move that lands on them. Verified:buildHeatmapwithNf3(10)+f3(4) yields one f3 cell of 14 games, sum preserved.ECO catalog no longer touches the main thread (architecture). #18 added
use-eco-lookup.ts, which dynamic-imported the ~830 kBeco-dataobject literal onto the main thread to name openings — a second parse of a catalog the worker already holds, against the CLAUDE.md rule that classification lives in the worker. That hook is deleted; naming now goes through alookupEcoComlink method on the scanner worker. Confirmed on the production build: the only chunks containing the catalog are worker chunks (Comlink.expose), the main-thread React chunk is 248 kB with zero EPD entries, and toggling the heatmap fetches nothing.Sample-size floor (consistency). The 3% share threshold ignored sample size, so a 2-game node could paint a saturated square — the exact thing
confidence-badgewas added to stop. A cell now needs ≥5 games and ≥3% share to be tinted; below either, the label still shows, untinted.Single-ECO-match label no longer vanishes. The shared-family strip now requires ≥2 named cells, so a lone match keeps its name instead of being reduced to nothing.
Gradient carries magnitude in more than hue. Lightness and alpha ramp with intensity alongside hue, so the scale survives grayscale and red/blue color deficiency and lets the wood grain show at the cold end. (The relative-to-max normalization is kept but its trade-off is now documented honestly: the % label carries the absolute magnitude.)
Simpler, more robust fade. The hand-rolled
displayed/ref/phase/rAF machine is replaced by a CSS mount animation for fade-in (reliable from the first frame) plus an opacity transition for fade-out.Smaller fixes. Toggle can no longer get stuck on-and-disabled (it's never disabled); dead
titletooltip removed;Switchlabelled viaaria-labelledbyinstead of a wrapping<label>; the 3.8 MB of screenshots indocs/heatmap/are gone (they belong in the PR, not the repo).Verification
1.d4— gradient reads correctly (Nf6 45%·60 hot, d5 33%·44 mid, rarer replies cool), sub-5-game cells untinted, names differentiate. Zero console errors.Note: this branch also carries
63f238b(chessendings.com docs), which was already committed here — shout if you'd rather it land on master separately.