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 · React hook

useNarabefunction

One game, kept in React state.

settings is read when the hook first runs and again on reset; give it a seed for a game that starts the same way every time.

Import it

import { useNarabe } from "@johnmorrisdotca/narabe/react";

Definition

function useNarabe(settings?: Partial<GameSettings>): NarabeGame

Parameters

NameTypeDescription
settings (optional)Partial<GameSettings>

The native game settings to interpret.

Returns

NarabeGame

The current position, available choices and native action callbacks.

Examples

import { createElement } from "react";
import { useNarabe } from "@johnmorrisdotca/narabe/react";
function Board() {
  const game = useNarabe({variant:"reversi"});
  return createElement("p",null,game.state.toPlay);
}
console.log(createElement(Board));

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