Reference · Rules, games and records
chanceOfWinningfunction
The chance, 0 to 1, that side wins from here, by the evaluation, or by the Keith count's rule of thumb in a race (as 0.5 plus a share of the count's lead).
Import it
import { chanceOfWinning } from "@johnmorrisdotca/sugoroku";
Definition
function chanceOfWinning(game: GameState, side: Side): number
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
side | Side | The side being examined: white or black. |
Returns
number
The chance, 0 to 1, that side wins from here, by the evaluation, or by the Keith count's rule of thumb in a race (as 0.5 plus a share of the count's lead).
Examples
import { chanceOfWinning, newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
console.log(chanceOfWinning(game,"white"));0.5632949741417992What it prints (run when this page was built)