Reference · Rules, games and records
opponentAtfunction
How many of the other side's checkers stand on the point that is side's own point own.
Import it
import { opponentAt } from "@johnmorrisdotca/sugoroku";
Definition
function opponentAt(spec: VariantSpec, position: Position, side: Side, own: number): number
Parameters
| Name | Type | Description |
|---|---|---|
spec | VariantSpec | The native variant specification. |
position | Position | The native checker counts, bar, reserve and borne-off counts. |
side | Side | The side being examined: white or black. |
own | number | A point in this side’s own numbering. |
Returns
number
How many of the other side's checkers stand on the point that is side's own point own.
Examples
import { opponentAt, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(opponentAt(spec,position,"white",24));0What it prints (run when this page was built)