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

placePiecefunction

Lays the piece in hand on cells. The cells must be that piece in some orientation, on empty points. A piece carries both colours, so it can finish a line for either side: one line wins for its owner, whoever laid it; a line for each is a draw.

Import it

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

Definition

function placePiece(state: GameState, cells: readonly PieceCell[]): GameState

Parameters

NameTypeDescription
stateGameState

The current immutable game position.

cellsreadonly PieceCell[]

The absolute coloured cells of the piece placement.

Returns

GameState

The resulting position; a refused or inapplicable action leaves the input position unchanged.

Examples

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

const queued = createGame({variant:"dominoFive",seed:42});
console.log(placePiece(queued, piecePlacements(queued)[0]).moves.length);
1

What it prints (run when this page was built)

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