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

movePiecefunction

Slides a piece one step, or in checkers a step or a capture. Illegal moves return the state unchanged.

Import it

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

Definition

function movePiece(state: GameState, from: Point, to: Point): GameState

Parameters

NameTypeDescription
stateGameState

The current immutable game position.

fromPoint

The source point of the group or moving piece.

toPoint

The destination point of the moving piece.

Returns

GameState

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

Examples

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

const checkers = createGame({variant:"checkers"});
console.log(movePiece(checkers,{row:5,col:0},{row:4,col:1}).moves.length);
0

What it prints (run when this page was built)

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