Reference · Rules, games and records
Playtype
A WHOLE TURN: the moves a side makes with a roll, in the order it makes them, and the position they leave.
Import it
import type { Play } from "@johnmorrisdotca/sugoroku";
Definition
type Play = {
readonly moves: readonly Move[];
readonly position: Position;
};
Members
| Name | Type | Description |
|---|---|---|
moves | readonly Move[] | |
position | Position |
Examples
import { legalPlaysOf, newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
import type { Play } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
const value: Play = play;
console.log(value);{
moves: [
{ from: 24, to: 21, die: 3, hit: false },
{ from: 24, to: 23, die: 1, hit: false }
],
position: {
points: [ [Array], [Array] ],
bar: [ 0, 0 ],
reserve: [ 0, 0 ],
off: [ 0, 0 ]
}
}What it prints (run when this page was built)