Reference · Rules, games and records
rollOpeningfunction
The opening throw: one die for white and one for black. The higher starts.
A tie changes nothing but opening, and the sides throw again. In a game
opened with a roll-off the starter plays the two dice as the first roll;
otherwise the starter then rolls as usual.
Import it
import { rollOpening } from "@johnmorrisdotca/sugoroku";
Definition
function rollOpening(game: GameState, throws: readonly [number, number]): GameState
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
throws | readonly [number, number] | The opening die for white, then black. |
Returns
GameState
The opening throw: one die for white and one for black. The higher starts. A tie changes nothing but opening, and the sides throw again. In a game opened with a roll-off the starter plays the two dice as the first roll; otherwise the starter then rolls as usual.
Examples
import { newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
console.log(rollOpening(newGame(settings),[3,1]).turn);whiteWhat it prints (run when this page was built)