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 · Board element

NarabeElementOptionstype

Host state, rules, replay choices, drawing options and callbacks.

Import it

import type { NarabeElementOptions } from "@johnmorrisdotca/narabe/element";

Also exported from: @johnmorrisdotca/narabe/element/define

Definition

type NarabeElementOptions = {
    state?: GameState;
    settings?: Partial<GameSettings>;
    moves?: readonly MoveInput[];
    choices?: readonly OpeningChoice[];
    clocked?: boolean;
    draw?: DrawBoardOptions;
    onChange?: (state: GameState) => void;
};

Members

NameTypeDescription
state (optional)GameState | undefined

Complete host position, taking precedence over replay input.

settings (optional)Partial<GameSettings> | undefined

Advanced native engine settings; attributes override these.

moves (optional)readonly MoveInput[] | undefined

Trusted host moves, used when the moves attribute is absent.

choices (optional)readonly OpeningChoice[] | undefined

Native colour-opening decisions.

clocked (optional)boolean | undefined

Whether recorded clock forfeits may replay.

draw (optional)DrawBoardOptions | undefined

Native SVG drawing options.

onChange (optional)((state: GameState) => void) | undefined

Called after a position changes, with the structured state.

Examples

import type { NarabeElementOptions } from "@johnmorrisdotca/narabe/element";
const options: NarabeElementOptions = { settings: { variant: "freestyle" }, draw: { legal: true } };
console.log(options.settings?.variant);
freestyle

What it prints (run when this page was built)

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