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

footprintFitsfunction

Whether every cell of a footprint is on the board and empty.

Import it

import { footprintFits } from "@johnmorrisdotca/narabe";

Definition

function footprintFits(board: Cell[], size: number, cells: readonly PieceCell[]): boolean

Parameters

NameTypeDescription
boardCell[]

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

sizenumber

The number of cells on each side of the board.

cellsreadonly PieceCell[]

The absolute coloured cells of the piece placement.

Returns

boolean

Whether every cell of a footprint is on the board and empty.

Examples

import { createGame, footprintFits } from "@johnmorrisdotca/narabe";

const state = createGame({variant:"freestyle",size:15});
const point = {row:7,col:7};
console.log(footprintFits(state.board,15,[{...point,stone:"black"}]));
true

What it prints (run when this page was built)

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