本文へ移動

Narabe並べ

48種類の盤上ゲームを、新しい局面を返す手の操作、合法手の一覧、再生できる棋譜で扱えます。

「並べ」は五目並べの「並べ」。石を並べることを表す言葉です。 名前について(英語)

目次

リファレンス · 盤面の要素

NarabeElementOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

ほかのエクスポート元: @johnmorrisdotca/narabe/element/define

定義

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

メンバー

名前型説明
state (省略可)GameState | undefined

Complete host position, taking precedence over replay input.

settings (省略可)Partial<GameSettings> | undefined

Advanced native engine settings; attributes override these.

moves (省略可)readonly MoveInput[] | undefined

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

choices (省略可)readonly OpeningChoice[] | undefined

Native colour-opening decisions.

clocked (省略可)boolean | undefined

Whether recorded clock forfeits may replay.

draw (省略可)DrawBoardOptions | undefined

Native SVG drawing options.

onChange (省略可)((state: GameState) => void) | undefined

Called after a position changes, with the structured state.

例

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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/narabe 1.3.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。