Reference · Rules, games and records
canDoublefunction
Whether the side on turn may offer a double now.
Import it
import { canDouble } from "@johnmorrisdotca/sugoroku";
Definition
function canDouble(game: GameState): boolean
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
Returns
boolean
Whether the side on turn may offer a double now.
Examples
import { canDouble, endTurn, legalPlaysOf, newGame, playTurn, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
const beforeRoll = playTurn(game,play.moves);
console.log(canDouble(beforeRoll));trueWhat it prints (run when this page was built)