Stage 13: alphabet on the wire (UI alphabet-agnostic, TODO-4)
Tests · Go / test (push) Successful in 10s
Tests · Integration / integration (push) Successful in 12s
Tests · UI / test (push) Successful in 19s
Tests · Go / test (pull_request) Successful in 9s
Tests · Integration / integration (pull_request) Successful in 12s
Tests · UI / test (pull_request) Successful in 19s
Tests · Go / test (push) Successful in 10s
Tests · Integration / integration (push) Successful in 12s
Tests · UI / test (push) Successful in 19s
Tests · Go / test (pull_request) Successful in 9s
Tests · Integration / integration (pull_request) Successful in 12s
Tests · UI / test (pull_request) Successful in 19s
Live play now exchanges per-variant alphabet indices instead of concrete letters (rack out; submit-play, evaluate, exchange, word-check in). The client caches each variant's (index, letter, value) table behind StateRequest.include_alphabet and renders the rack and blank chooser from it, dropping the hardcoded value/alphabet tables. History, the durable journal and GCG stay decoded concrete characters (ARCHITECTURE §9.1, unchanged). - pkg/fbs: new AlphabetEntry + PlayTile; StateView.rack -> [ubyte] + alphabet; StateRequest.include_alphabet; SubmitPlay/Eval tiles -> [PlayTile]; Exchange tiles + CheckWord word -> [ubyte] (committed Go + TS regenerated). - engine: AlphabetTable + a cached per-variant codec (LetterForIndex/EncodeRack/ DecodeTiles/DecodeWord) + BlankIndex sentinel; Go parity test. - backend server edge maps index<->letter (new thin game.Service.GameVariant); game.Service domain methods, engine.Game and the robot keep one letter-based play path. The gateway forwards indices verbatim (no alphabet table). - ui: lib/alphabet.ts in-memory cache; codec encodes/decodes indices; premiums.ts is geometry-only; the mock seeds a fixture table; the UI normalises display to upper case (codec + cache), leaving placement/board/checkword unchanged. Parity moved to the Go engine.AlphabetTable test; premiums.ts loses its value tables. Discharges TODO-4.
This commit is contained in:
+44
-14
@@ -14,8 +14,9 @@ namespace scrabblefb;
|
||||
|
||||
// --- shared building blocks ---
|
||||
|
||||
// TileRecord is one placed (or to-place) tile: its board coordinate, the concrete
|
||||
// letter ("?" when read from a hand for a blank) and whether it came from a blank.
|
||||
// TileRecord is one tile in a decoded move record (history, move result, hint): its
|
||||
// board coordinate, the concrete letter ("?" when read from a hand for a blank) and
|
||||
// whether it came from a blank. Inbound tiles to place use PlayTile (alphabet indices).
|
||||
table TileRecord {
|
||||
row:int;
|
||||
col:int;
|
||||
@@ -23,6 +24,25 @@ table TileRecord {
|
||||
blank:bool;
|
||||
}
|
||||
|
||||
// PlayTile is one inbound tile to place, addressed by its alphabet index rather than a
|
||||
// concrete letter (Stage 13). For a blank, letter carries the designated letter's index
|
||||
// and blank is true. The board coordinate is its target square.
|
||||
table PlayTile {
|
||||
row:int;
|
||||
col:int;
|
||||
letter:ubyte;
|
||||
blank:bool;
|
||||
}
|
||||
|
||||
// AlphabetEntry is one letter of a variant's alphabet, sent for display only (Stage 13):
|
||||
// index is the engine alphabet-index byte the wire uses for this letter, letter is the
|
||||
// concrete character and value is its tile score. The client caches the table per variant.
|
||||
table AlphabetEntry {
|
||||
index:ubyte;
|
||||
letter:string;
|
||||
value:int;
|
||||
}
|
||||
|
||||
// SeatView is one seat's public standing in a game. display_name is resolved by the
|
||||
// backend from the account store (added trailing — backward-compatible).
|
||||
table SeatView {
|
||||
@@ -123,11 +143,12 @@ table Profile {
|
||||
|
||||
// --- game (authenticated) ---
|
||||
|
||||
// SubmitPlayRequest places tiles in a direction on the player's turn.
|
||||
// SubmitPlayRequest places tiles in a direction on the player's turn. tiles are addressed
|
||||
// by alphabet index (Stage 13).
|
||||
table SubmitPlayRequest {
|
||||
game_id:string;
|
||||
dir:string;
|
||||
tiles:[TileRecord];
|
||||
tiles:[PlayTile];
|
||||
}
|
||||
|
||||
// MoveResult is the outcome of a committed move: the move and the post-move game.
|
||||
@@ -136,19 +157,25 @@ table MoveResult {
|
||||
game:GameView;
|
||||
}
|
||||
|
||||
// StateRequest asks for the requesting player's view of a game.
|
||||
// StateRequest asks for the requesting player's view of a game. include_alphabet asks the
|
||||
// backend to embed the variant's AlphabetEntry table in the reply (Stage 13); the client
|
||||
// sets it only on a per-variant cache miss so the table is not resent on every poll.
|
||||
table StateRequest {
|
||||
game_id:string;
|
||||
include_alphabet:bool = false;
|
||||
}
|
||||
|
||||
// StateView is a player's view of a game: the shared summary plus their private
|
||||
// rack, the bag size and their remaining hint budget.
|
||||
// StateView is a player's view of a game: the shared summary plus their private rack, the
|
||||
// bag size and their remaining hint budget. rack carries alphabet indices (Stage 13); a
|
||||
// blank tile is the sentinel index 255. alphabet is present only when the request set
|
||||
// include_alphabet (a display table the client caches per variant).
|
||||
table StateView {
|
||||
game:GameView;
|
||||
seat:int;
|
||||
rack:[string];
|
||||
rack:[ubyte];
|
||||
bag_len:int;
|
||||
hints_remaining:int;
|
||||
alphabet:[AlphabetEntry];
|
||||
}
|
||||
|
||||
// GameActionRequest carries just a game id (pass / resign / hint / history).
|
||||
@@ -156,17 +183,19 @@ table GameActionRequest {
|
||||
game_id:string;
|
||||
}
|
||||
|
||||
// ExchangeRequest swaps the listed rack tiles back into the bag.
|
||||
// ExchangeRequest swaps the listed rack tiles back into the bag. tiles are alphabet
|
||||
// indices (Stage 13); a blank is the sentinel index 255.
|
||||
table ExchangeRequest {
|
||||
game_id:string;
|
||||
tiles:[string];
|
||||
tiles:[ubyte];
|
||||
}
|
||||
|
||||
// EvalRequest previews a tentative play without committing it.
|
||||
// EvalRequest previews a tentative play without committing it. tiles are addressed by
|
||||
// alphabet index (Stage 13).
|
||||
table EvalRequest {
|
||||
game_id:string;
|
||||
dir:string;
|
||||
tiles:[TileRecord];
|
||||
tiles:[PlayTile];
|
||||
}
|
||||
|
||||
// EvalResult is an unlimited move preview: legality, score and the words formed.
|
||||
@@ -176,10 +205,11 @@ table EvalResult {
|
||||
words:[string];
|
||||
}
|
||||
|
||||
// CheckWordRequest looks a word up in the game's pinned dictionary.
|
||||
// CheckWordRequest looks a word up in the game's pinned dictionary. word is a sequence of
|
||||
// alphabet indices (Stage 13); the client constrains input to the variant's alphabet.
|
||||
table CheckWordRequest {
|
||||
game_id:string;
|
||||
word:string;
|
||||
word:[ubyte];
|
||||
}
|
||||
|
||||
// WordCheckResult is the dictionary lookup outcome.
|
||||
|
||||
Reference in New Issue
Block a user