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 · SVG boards

boardSvgfunction

The position as one <svg> element, drawn the way its game is traditionally drawn.

Import it

import { boardSvg } from "@johnmorrisdotca/narabe/draw";

Definition

function boardSvg(state: GameState, options?: DrawBoardOptions): string

Parameters

NameTypeDescription
stateGameState

The current immutable game position.

options (optional)DrawBoardOptions

SVG size, label and highlighting options.

Returns

string

One standalone SVG string representing the position.

Examples

import { createGame } from "@johnmorrisdotca/narabe";
import { boardSvg } from "@johnmorrisdotca/narabe/draw";

const state = createGame({variant:"freestyle",size:15});
console.log(boardSvg(state, { legal: true }).startsWith("<svg"));
true

What it prints (run when this page was built)

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