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

twistBoardfunction

Turns one quadrant to finish the move. The whole board is read afterwards, because a turn can complete a line for either colour anywhere: one line wins for its owner, a line for each is a draw, and a full board with no line is a draw too.

Import it

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

Definition

function twistBoard(state: GameState, quadrant: number, clockwise: boolean): GameState

Parameters

NameTypeDescription
stateGameState

The current immutable game position.

quadrantnumber

The zero-based quadrant index.

clockwiseboolean

Whether to turn clockwise rather than anticlockwise.

Returns

GameState

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

Examples

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

console.log(twistBoard(playMove(createGame({variant:"twistFive"}),{row:0,col:0}),0,true).pendingTwist);
false

What it prints (run when this page was built)

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