Reference · Rules, games and records
wantsToTakefunction
Whether the computer, doubled, should take.
Import it
import { wantsToTake } from "@johnmorrisdotca/sugoroku";
Definition
function wantsToTake(game: GameState, options?: ComputerOptions): boolean
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The current immutable native game state. |
options (optional) | ComputerOptions | Native drawing, geometry, mounting or computer choices specified by the signature. |
Returns
boolean
Whether the computer, doubled, should take.
Examples
import { endTurn, legalPlaysOf, newGame, offerDouble, playTurn, rollOpening, settingsFor, wantsToTake } 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);
const offered = offerDouble(beforeRoll);
console.log(wantsToTake(offered,{strength:"greedy"}));trueWhat it prints (run when this page was built)