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/narabeNode 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
trueCoordinates 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.