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

canSwapSeatsfunction

Whether the seat to play may trade seats right now. This covers the mechanical limits only; analysis.ts adds the rule that you cannot swap into a position the opponent has already won. Not while an opening protocol is still settling who holds which colour, and never under a handicap, which belongs to a colour and would otherwise change hands with it.

Import it

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

Definition

function canSwapSeats(state: GameState): boolean

Parameters

NameTypeDescription
stateGameState

The current immutable game position.

Returns

boolean

Whether the seat to play may trade seats right now. This covers the mechanical limits only; analysis.ts adds the rule that you cannot swap into a position the opponent has already won. Not while an opening protocol is still settling who holds which colour, and never under a handicap, which belongs to a colour and would otherwise change hands with it.

Examples

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

const state = createGame({variant:"freestyle",size:15});
console.log(canSwapSeats(state));
false

What it prints (run when this page was built)

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