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

Getting started

Getting started

Install Narabe, create a game and play two moves.

Use one immutable rules engine for forty-eight abstract board games. The core needs no DOM or runtime dependency; the optional React entry needs React 18 or later.

Install

npm install @johnmorrisdotca/narabe

Node 22 or later and modern browsers can import its typed ES modules.

Play two stones

import {createGame, playMove, pointName} from "@johnmorrisdotca/narabe";
let game = createGame({variant:"renju",size:15});
game = playMove(game,{row:7,col:7});
game = playMove(game,{row:7,col:8});
console.log(game.toPlay, pointName(15,{row:7,col:7}));
console.log(playMove(game,{row:7,col:7}) === game);
black H8
true

Coordinates are zero-based from the top left. Keep the returned position. An illegal or inapplicable action returns the input unchanged, so equality can distinguish a refused action. Game-specific settings may normalize the requested board size.

Choose a recipe

Legal choices, Go, records, SVG and React and embeds cover the next steps. The reference lists native rules and data.

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