Skip to content

feat: draw WikiRace races in the viewer like Wikipedia - #39

Merged
osolmaz merged 1 commit into
mainfrom
feat/wikirace-viewer
Oct 29, 2026
Merged

osolmaz merged 1 commit into
mainfrom
feat/wikirace-viewer

Conversation

@osolmaz

@osolmaz osolmaz commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

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.

  • Drawing (examples/wikirace/src/web/route.ts):
    • The head shows the start, the target as a link, the hops so far, and a status: racing, reached, gave up, dead end, step limit or failed.
    • The route at the left shows each article like a stop of a train line, the current one marked and the target apart.
    • The branches at the right show the eight likeliest links, sections and giving up of the step. Each has a bar and a curve whose width follows the probability, and the picked one is always among them. Before the model answers, they are in the article's order.
  • Data (data.ts): reads the race from a state and the branches from a step's pick.
  • Steps list (part.ts): each step's destination and probability; each entry opens its step.
  • Styles (wikirace.css): Wikipedia's light colors, and its night colors under prefers-color-scheme: dark, as CSS variables. Text has at least 4.5:1 contrast. Motion stops under prefers-reduced-motion. A container query drops the curves when the drawing is narrow, so a phone has no sideways scroll.
  • Viewer: FrameChoice gains type, read from the pick's facts; null for a choice question that is no pick.
  • Domain: a section's choice keeps { section, links } as its data.

Testing

All tests use the fake decider and a fake wiki; no model was called in the tests.

  • pnpm check at the root passes. Tests: root 71, viewer 39, chess 75, rubric-judge 49, WikiRace 26 (6 new page tests).
  • I looked at two real Jev races (DNA to Manipuri pony, Rubber duck to Moon) saved with 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.

  • The view state (the open step) is still not in the URL. That is a change of the viewer for all domains, so it is not in this PR.

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.
@osolmaz osolmaz self-assigned this Oct 29, 2026
@osolmaz
osolmaz merged commit d5751fd into main Oct 29, 2026
1 check passed
@osolmaz
osolmaz deleted the feat/wikirace-viewer branch October 29, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant