Reference · Boards, rules and challenges
isGameStuckfunction
Checks whether no legal continuation remains before the goal is reached.
Import it
import { isGameStuck } from "@johnmorrisdotca/tobiishi";
Definition
function isGameStuck(game: Game): boolean
Parameters
| Name | Type | Description |
|---|---|---|
game | Readonly<{ board: Board; start: readonly boolean[]; pegs: readonly boolean[]; target: number | null; history: readonly Jump[]; helped: boolean; }> | The immutable native peg position, board, target, history and assistance marker. |
Returns
boolean
Checks whether no legal continuation remains before the goal is reached.
Examples
import { isGameStuck, makeBoard, newGame } from "@johnmorrisdotca/tobiishi";
const board = makeBoard("Three holes",[{x:0,y:0},{x:1,y:0},{x:2,y:0}]);
const game = newGame(board,[true,true,false],2);
console.log(isGameStuck(game));falseWhat it prints (run when this page was built)