Reference · Rules, games and records
positionKeyfunction
A position as a short string that is the same for the same position, for keeping a set of them.
Import it
import { positionKey } from "@johnmorrisdotca/sugoroku";
Definition
function positionKey(position: Position): string
Parameters
| Name | Type | Description |
|---|---|---|
position | Position | The native checker counts, bar, reserve and borne-off counts. |
Returns
string
A position as a short string that is the same for the same position, for keeping a set of them.
Examples
import { positionKey, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(positionKey(position));0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2|0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2|0,0|0,0|0,0What it prints (run when this page was built)