Reference · Rules, games and records
positionIdfunction
The ID of a position with onRoll to move, or null if it cannot be written in this form.
Import it
import { positionId } from "@johnmorrisdotca/sugoroku";
Definition
function positionId(position: Position, onRoll: Side): string | null
Parameters
| Name | Type | Description |
|---|---|---|
position | Position | The native checker counts, bar, reserve and borne-off counts. |
onRoll | Side | The side to roll, or whether this evaluated side is on roll, specified by the signature. |
Returns
string | null
The ID of a position with onRoll to move, or null if it cannot be written in this form.
Examples
import { positionId, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(positionId(position,"white"));4HPwATDgc/ABMAWhat it prints (run when this page was built)