SugorokuEventDetail型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What every event of the board carries.
インポート
import type { SugorokuEventDetail } from "@johnmorrisdotca/sugoroku/play";
定義
type SugorokuEventDetail = {
side: Side | null;
game: GameState;
match: Match;
dice?: readonly number[];
notation?: string;
move?: Move;
moves?: readonly Move[];
action?: "double" | "take" | "drop" | "beaver";
result?: GameResult;
record?: string;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
side | Side | null | The side it is about; null for the opening throw. |
game | GameState | |
match | Match | |
dice (省略可) | readonly number[] | undefined | Dice: for a roll, those rolled; for a turn, the roll played. |
notation (省略可) | string | undefined | A move in standard notation, or a turn's play. |
move (省略可) | Move | undefined | |
moves (省略可) | readonly Move[] | undefined | |
action (省略可) | "double" | "take" | "drop" | "beaver" | undefined | What was done to the cube. |
result (省略可) | GameResult | undefined | The result, for |
record (省略可) | string | undefined | The record of the match so far, for |
例
import { newGame, newMatch, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
import type { SugorokuEventDetail } from "@johnmorrisdotca/sugoroku/play";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const match = newMatch(settings);
const value: SugorokuEventDetail = {side:"white",game,match,dice:[3,1]};
console.log(value);{
side: 'white',
game: {
settings: { variant: [Object], rules: [Object] },
crawford: false,
score: [ 0, 0 ],
position: { points: [Array], bar: [Array], reserve: [Array], off: [Array] },
turn: 'white',
phase: 'playing',
dice: [ 3, 1 ],
need: [ 3, 1 ],
plan: [ 3, 1 ],
moves: [],
turnStart: { points: [Array], bar: [Array], reserve: [Array], off: [Array] },
cube: { value: 1, owner: null },
offeredBy: null,
turns: [ 0, 0 ],
opening: [ 3, 1 ],
result: null
},
match: {
settings: { variant: [Object], rules: [Object] },
score: [ 0, 0 ],
results: [],
crawfordNext: false,
crawfordPlayed: false,
over: false,
winner: null
},
dice: [ 3, 1 ]
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。