isLegalMovefunction
Whether the colour to move may play point: on the board, empty, allowed by
the opening, not a shape the variant forbids that colour, the landing cell
of its column in a drop game, and not while a twist or a slide is owed.
Import it
import { isLegalMove } from "@johnmorrisdotca/narabe";
Definition
function isLegalMove(state: GameState, point: Point): boolean
Parameters
| Name | Type | Description |
|---|---|---|
state | GameState | The current immutable game position. |
point | Point | A zero-based row and column on the board. |
Returns
boolean
Whether a stone placement is legal at this point in the current phase.
Examples
import { createGame, isLegalMove } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
const point = {row:7,col:7};
console.log(isLegalMove(state, point));trueWhat it prints (run when this page was built)