StoredGametype
The stored shape of a game, as both the API and the pages see it.
Import it
import type { StoredGame } from "@johnmorrisdotca/narabe";
Definition
type StoredGame = {
size: number;
winLength: number;
variant: string;
obstacles: string;
opener: string;
opening?: string;
handicap?: Handicap | null;
headStart?: HeadStart | null;
seed?: number;
drawLimit?: string;
moveTimeMs: number | null;
moves: MoveInput[];
};
Members
| Name | Type | Description |
|---|---|---|
size | number | |
winLength | number | |
variant | string | |
obstacles | string | |
opener | string | |
opening (optional) | string | undefined | |
handicap (optional) | Handicap | null | undefined | |
headStart (optional) | HeadStart | null | undefined | The head start, parsed — see |
seed (optional) | number | undefined | |
drawLimit (optional) | string | undefined | See DrawLimit. Games recorded before it existed carry "none", as they were played. |
moveTimeMs | number | null | The clock, or null for none. Required rather than optional: a turn lost to the clock replays only on a record that had one, and a reader that forgot to pass it would cut every such game short at the turn that was lost. |
moves | MoveInput[] |
Examples
import type { StoredGame } from "@johnmorrisdotca/narabe";
const stored = {size:15,winLength:5,variant:"freestyle",obstacles:"none",opener:"black",moveTimeMs:null,moves:[{row:7,col:7}]};
const value: StoredGame = stored;
console.log(value);{
size: 15,
winLength: 5,
variant: 'freestyle',
obstacles: 'none',
opener: 'black',
moveTimeMs: null,
moves: [ { row: 7, col: 7 } ]
}What it prints (run when this page was built)