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

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

NameTypeDescription
stateGameState

The current immutable game position.

pointPoint

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));
true

What it prints (run when this page was built)

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