Reference · Rules, games and records
sideToActfunction
Whether a side is the one the computer would act for at this moment of a game: the side on turn, or the side that must answer a double.
Import it
import { sideToAct } from "@johnmorrisdotca/sugoroku";
Definition
function sideToAct(game: GameState): Side | null
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
Returns
Side | null
The side to make the next decision, or null during opening or after the game ends.
Examples
import { newGame, rollOpening, settingsFor, sideToAct } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
console.log(sideToAct(game));whiteWhat it prints (run when this page was built)