Reference · Rules, games and records
formatPlayfunction
The text of a whole turn: moves of one checker joined, equal moves counted, the farthest-back checker first. A turn of no moves is -.
Import it
import { formatPlay } from "@johnmorrisdotca/sugoroku";
Definition
function formatPlay(moves: readonly Move[]): string
Parameters
| Name | Type | Description |
|---|---|---|
moves | readonly Move[] | Legal checker moves in their played order. |
Returns
string
The text of a whole turn: moves of one checker joined, equal moves counted, the farthest-back checker first. A turn of no moves is -.
Examples
import { formatPlay, legalPlaysOf, newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
console.log(formatPlay(play.moves));24/21 24/23What it prints (run when this page was built)