forbiddenAtfunction
Why stone may not play point, or null when it may. Only the patterns the
variant forbids that colour are looked for, so this is cheap outside renju
and omok.
Import it
import { forbiddenAt } from "@johnmorrisdotca/narabe";
Definition
function forbiddenAt(board: Cell[], settings: GameSettings, stone: Stone, point: Point, depth?: number): ForbiddenPattern | null
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
settings | GameSettings | The native game settings to interpret. |
stone | Stone | The black or white colour being examined. |
point | Point | A zero-based row and column on the board. |
depth (optional) | number | The current recursion depth of the forbidden-shape analysis. |
Returns
ForbiddenPattern | null
The forbidden pattern, or null when the rules permit the shape.
Examples
import { createGame, forbiddenAt } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
const point = {row:7,col:7};
console.log(forbiddenAt(state.board,state.settings,"black",point));nullWhat it prints (run when this page was built)