Reference · Rules, games and records
playMovesfunction
The position after a list of moves, made one after another.
Import it
import { playMoves } from "@johnmorrisdotca/sugoroku";
Definition
function playMoves(spec: VariantSpec, position: Position, side: Side, moves: readonly Move[]): Position
Parameters
| Name | Type | Description |
|---|---|---|
spec | VariantSpec | The native variant specification. |
position | Position | The native checker counts, bar, reserve and borne-off counts. |
side | Side | The side being examined: white or black. |
moves | readonly Move[] | Legal checker moves in their played order. |
Returns
Position
The position after a list of moves, made one after another.
Examples
import { legalPlaysOf, newGame, playMoves, rollOpening, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
console.log(playMoves(spec,position,"white",play.moves).bar);[ 0, 0 ]What it prints (run when this page was built)