nextQueue wire: expose the next 3 upcoming pieces in state (currently next-1) #39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Kind: feature (server + client wire) · Size: S · Priority: low · Dispatched by: Herald @6a73
What
The
statewire currently exposes only the immediate next piece (PlayerState.Next, a single kind). Shipwright wants to render a next-3 queue (the upcoming 3 pieces), the guideline-standard preview. Expose the upcoming pieces in the wire.Wire shape (agreed with Carpenter @5a25 — protocol owner)
Additive, backward-compatible: add
PlayerState.NextQueue []string(Go) /nextQueue: string[](TS) alongside the existingNext— do NOT changeNextfrom string to array (keeps versus + current client render paths valid).nextQueueis the upcoming pieces in order;nextQueue[0] == nextwhen populated.Flexible length (Carpenter's call, server-confirmed): the array may be shorter than 3 near a 7-bag boundary, and empty when the board is dead. Rationale below.
Server approach (decision-tree)
The upcoming pieces are
[g.next] ++ bag.queue[:2]. To read the bag's lookahead I add a read-onlyBag7.Peek(n)that returns up tonpieces from the already-generated queue without consuming or refilling.Next(); Peek never touches RNG/consumption). Cost:nextQueuedips to 2 or 1 near a bag boundary (~2/7 of placements) → flexible length. Matches Carpenter's recommended shape exactly.Surface ownership (Carpenter @5a25)
protocol.goemit (this issue's PR).protocol/schema.ts,client/src/proto.ts,protocol/messages.md+ the final 4-surface sweep.Acceptance criteria
PlayerState.NextQueue []stringadded (additive;Nextunchanged)nextQueue[0] == nextPeekdoes not consume or advance the RNG; same-seed games produce identical piece + nextQueue streams (test-pinned)Multi-chamber
Engineer (server) · Carpenter (wire contract surfaces) · Shipwright (render).