Skip to the content

Narabe並べ

Play forty-eight abstract board games through immutable moves, legal choices and replayable records.

Narabe means arranging in Japanese, as in gomoku-narabe: five in a row. About the name

Contents

Reference · Rules and records

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

NameTypeDescription
boardCell[]

The row-major board cells; null marks an empty point.

settingsGameSettings

The native game settings to interpret.

pointPoint

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/narabe 1.3.0.