Reference · Rules, games and records
pipCountfunction
The pip count of a side: the sum of every checker's distance from being borne off. A checker on the bar or yet to enter counts 25.
Import it
import { pipCount } from "@johnmorrisdotca/sugoroku";
Definition
function pipCount(position: Position, side: Side): number
Parameters
| Name | Type | Description |
|---|---|---|
position | Position | The native checker counts, bar, reserve and borne-off counts. |
side | Side | The side being examined: white or black. |
Returns
number
The pip count of a side: the sum of every checker's distance from being borne off. A checker on the bar or yet to enter counts 25.
Examples
import { pipCount, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(pipCount(position,"white"));167What it prints (run when this page was built)