Reference · Rules, games and records
offerDoublefunction
Offer a double: the other side must now take it or drop it.
Import it
import { offerDouble } from "@johnmorrisdotca/sugoroku";
Definition
function offerDouble(game: GameState): GameState
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
Returns
GameState
Offer a double: the other side must now take it or drop it.
Examples
import { endTurn, legalPlaysOf, newGame, offerDouble, 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(offerDouble(beforeRoll).phase);double-offeredWhat it prints (run when this page was built)