findWinningLinefunction
The winning line through point, if the stone there completes one under
the rule that applies to its colour. Only lines through the given point are
examined, which is all that can change after a single move. Returns an
empty array when there is no win.
Import it
import { findWinningLine } from "@johnmorrisdotca/narabe";
Definition
function findWinningLine(board: Cell[], settings: GameSettings, point: Point): Point[]
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
settings | GameSettings | The native game settings to interpret. |
point | Point | A zero-based row and column on the board. |
Returns
Point[]
The winning line through the point, or an empty array without one.
Examples
import { createGame, findWinningLine } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
const point = {row:7,col:7};
console.log(findWinningLine(state.board,state.settings,point));[]What it prints (run when this page was built)