Repository navigation
feat: draw WikiRace races in the viewer like Wikipedia - #39
Merged
Merged
Conversation
The WikiRace part of the viewer now draws the route of the articles so far, with the target at its end, and each step's likeliest branches from the article the race is at: links, sections and giving up, with the model's probability as a bar and as the width of a curve, and the picked branch marked. The list of steps says where each step went. The page uses Wikipedia's light colors, or its night colors when the system asks for dark, and fits a phone's width. - The viewer gives each choice of a pick its type, from the pick's facts. - A section's choice keeps its name and its number of links as its data.
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.
Summary
The WikiRace part of the viewer showed only a row of article names, so a race was hard to follow.
Now it draws the route so far and each step's branches, with the model's probability for each, in Wikipedia's look.
Each choice of a pick now carries its type in the viewer, so the part can tell links, sections and giving up apart.
What Changed
The part follows the chess part's pattern: plain browser modules that the page joins into one script, and one stylesheet. It adds no dependency.
examples/wikirace/src/web/route.ts):data.ts): reads the race from a state and the branches from a step's pick.part.ts): each step's destination and probability; each entry opens its step.wikirace.css): Wikipedia's light colors, and its night colors underprefers-color-scheme: dark, as CSS variables. Text has at least 4.5:1 contrast. Motion stops underprefers-reduced-motion. A container query drops the curves when the drawing is narrow, so a phone has no sideways scroll.FrameChoicegainstype, read from the pick's facts; null for a choice question that is no pick.{ section, links }as its data.Testing
All tests use the fake decider and a fake wiki; no model was called in the tests.
pnpm checkat the root passes. Tests: root 71, viewer 39, chess 75, rubric-judge 49, WikiRace 26 (6 new page tests).view --html. I took headless-Chrome screenshots at 1440x900 in light and dark, and at 390x844.Risks
The risk is low: the change is limited to one example's part and one new field in the viewer's frames.