Reference · Rules, games and records
keithCountfunction
The Keith count of a side, a pip count corrected for how badly the checkers are placed for bearing off: plus 2 for each checker beyond the first on the 1-point, 1 for each beyond the first on the 2-point and beyond three on the 3-point, and 1 for each empty point among the 4, 5 and 6, and then the side on roll adds a seventh (rounded down). For races only.
Import it
import { keithCount } from "@johnmorrisdotca/sugoroku";
Definition
function keithCount(position: Position, side: Side, onRoll: boolean): 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. |
onRoll | boolean | The side to roll, or whether this evaluated side is on roll, specified by the signature. |
Returns
number
The Keith count of a side, a pip count corrected for how badly the checkers are placed for bearing off: plus 2 for each checker beyond the first on the 1-point, 1 for each beyond the first on the 2-point and beyond three on the 3-point, and 1 for each empty point among the 4, 5 and 6, and then the side on roll adds a seventh (rounded down). For races only.
Examples
import { keithCount, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(keithCount(position,"white",true));193What it prints (run when this page was built)