Reference · Rules, games and records
evaluateForfunction
The score as side plays to win or to lose: a game played to lose is judged the other way up.
Import it
import { evaluateFor } from "@johnmorrisdotca/sugoroku";
Definition
function evaluateFor(spec: VariantSpec, position: Position, side: Side, weights?: EvaluationWeights): 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. |
weights (optional) | EvaluationWeights | Optional weights for the native position evaluation. |
Returns
number
The score as side plays to win or to lose: a game played to lose is judged the other way up.
Examples
import { evaluateFor, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(evaluateFor(spec,position,"white"));5.6What it prints (run when this page was built)