Wheel of Cheese Wiring

How the game show runs. Everything that decides anything lives in the room server; the browsers and the Discord picture draw what it publishes; Harry is a bystander who heckles when spoken to.

One turn of the game, in order

palacebot · room server harryd A player's browser types "spin", "is there an S?", "I'd like to buy a vowel", the answer, or a heckle: "Ratbot, nice tie" Every browser draws the board from the rows, computes Bananna's spot from the reveal record and the clock, shows Ratbot's balloons, logs the board as text for screen readers Discord's pinned picture the same renderer, on the server, every 20 s: board, Bananna, balloons talk() · the line becomes a balloon for everyone first then, while a game is on: strip "Ratbot," / "rat" / "spud"; if it's the current player and a move is expected, turn plain English into the one-word command CheeseGame (cheese.ts) the 1996 Ratbot state machine, ported: waitSpin → waitCons / waitVowel waitSolve · waitFreeSpin · final1/2 24-slot wheel, 250-cheese vowels, three rounds and a final, timeouts and nudges, turn queue, top ten per room reads, at start: games/wheel-of-cheese/puzzles.json prizes.json · lines.json random source injected (tests script it); nothing here calls a model Ratbot, a puppet a head the game owns: rat props for moods, no socket, no seat, hosts may drag him "cheese" widget public state, in the scene: rows · missed · players reveal {at,cols,from} bananna · clapUntil Ratbot's balloons, with the original prefixes sign @310,78^ category + prompt · marquee !@500,44 spin result · plain lines from his head any plain line kills the sticky sign, as in 1996; the game re-posts it after every one tick(), once a second turn timeouts (15 s absent, 30 s nudge, 45 s scold, 60 s skip), the 40 s final clock, the clap Harry hears game events and lines marked "to: Ratbot"; answers as Ratbot, one line; a quip over 8 s late is dropped OpenRouter one completion per turn; the game never waits for it, a slow model delays only Harry wss a move: the game takes it, Harry never sees it a heckle, not a move say·emote publish scene message: widget state · talk messages: balloons same state say as:Ratbot game events: started · solved · final · ended
Solid arrows are the game; dashed ones are Harry, who is optional. Bananna's walk is a record, not a stream of frames: the server writes when it started, which columns she turns and from which side, and each screen works out where she is from its own clock, so a late joiner and the Discord picture agree.

The turn, step by step

StepWhereWhat happens
1Browser → room server"is there an S?" arrives over the WebSocket like any other line, and everyone sees the balloon at once.
2talk()The word filter is skipped for game lines; "Ratbot," is stripped; because the speaker is the current player and a consonant is expected, the line becomes s.
3CheeseGameThe state machine counts the S's, pays the spin value in cheese, marks the letter guessed, and chooses its lines from lines.json with the injected random source.
4PuppetRatbot's props change to the mood, and he speaks: a plain line ("There are two Ss"), then the sign is re-posted with the prompt. Balloons are anchored with the original @x,y prefix.
5Widget stateThe board rows are updated, and a reveal record is written: start time, the columns holding S's in walking order, and which side Bananna starts from. Her side flips for next time.
6Every screenThe scene message carries the new state. Each browser lights the tiles, walks Bananna column by column from the record and its clock, and turns each tile as she reaches it. The transcript and a live region get the board as text.
7Harry (only if the line wasn't a move)"Ratbot, nice tie" is not a move, so it goes to harryd tagged for Ratbot. Harry calls OpenRouter and answers with say { as: "Ratbot" }, which the server speaks from the puppet's head. If the answer takes over eight seconds it is dropped. The game never waited.
8DiscordWithin twenty seconds the pinned picture is re-rendered by the same code, mid-walk if that's where she is.

Why the game is not Harry

Fairness and speed. The wheel, the letters, the money and the timeouts are ordinary code with tests; a player's move is answered in the same tick it arrives, and no model or budget is involved. Harry is a heckler, not a referee.

Whispers to Ratbot

help, help2, money, recap and top10 can be whispered to Ratbot's head; he whispers the answer back. Whispers never reach Harry or Discord.

How a game ends

Ratbot says goodnight 45 s after the last game unless someone says play; a host's stop or reset ends it at once. The puppet leaves, the widget goes, a caption credits the artist, and "Meanwhile, in Harry's Bar…" marks the return.

Where the text lives

Puzzles (the 1996 list and the 2026 additions, kept apart), prizes, and every line Ratbot says are JSON under games/wheel-of-cheese/. The mechanics never change when the text does.

Back to the wiring overview · All docs