Table options: the host's choices when opening a table, declared by the game, recorded on the room line
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
2ab6dc4b5f
commit
63bd154798
@@ -21,9 +21,23 @@ export interface Outcome {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
/** A choice the host makes when opening a table: a variant, a side, a length. */
|
||||
export interface TableOption {
|
||||
key: string;
|
||||
label: string;
|
||||
choices: { value: string; label: string }[];
|
||||
/** The value a table gets when the host chooses nothing. */
|
||||
default: string;
|
||||
}
|
||||
|
||||
/** The host's choices for a table, by option key; only keys the game declares get through. */
|
||||
export type TableOptions = Record<string, string>;
|
||||
|
||||
export interface GameSpec<State, Input> {
|
||||
/** Seats in table order; the table takes at most this many. */
|
||||
seatIds: SeatId[];
|
||||
/** What the host may choose when opening a table; empty for a game with one way to play. */
|
||||
options?: TableOption[];
|
||||
minSeats: number;
|
||||
/** Names the server draws for bots, in preference order. */
|
||||
botNames: string[];
|
||||
@@ -35,7 +49,7 @@ export interface GameSpec<State, Input> {
|
||||
*/
|
||||
currentRules: number;
|
||||
|
||||
create(names: Record<SeatId, string>, seed: number, rules: number): State;
|
||||
create(names: Record<SeatId, string>, seed: number, rules: number, options?: TableOptions): State;
|
||||
/** Resolve one round. Must be a pure function of its arguments: the ledger is replayed through it. */
|
||||
resolve(state: State, inputs: Record<SeatId, Input>): State;
|
||||
/** Whether this seat's input is needed before the next resolution. */
|
||||
|
||||
Reference in New Issue
Block a user