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 · Rules and records

ColourRulestype

The rules one colour actually plays under: the variant's spec for that colour with the handicap laid over it. Everything in the engine that asks "may this colour…" reads one of these, never the spec directly.

Import it

import type { ColourRules } from "@johnmorrisdotca/narabe";

Definition

type ColourRules = {
    lineRule: LineRule;
    forbidden: readonly ForbiddenPattern[];
    captures: boolean;
    stonesPerTurn: number;
    winLength: number;
    secondStoneExclusion: number;
};

Members

NameTypeDescription
lineRuleLineRule
forbiddenreadonly ForbiddenPattern[]
capturesboolean
stonesPerTurnnumber
winLengthnumber
secondStoneExclusionnumber

Examples

import { createGame, rulesFor } from "@johnmorrisdotca/narabe";
import type { ColourRules } from "@johnmorrisdotca/narabe";

const state = createGame({variant:"freestyle",size:15});
const value: ColourRules = rulesFor(state.settings,"black");
console.log(value);
{
  lineRule: 'atLeast',
  forbidden: [],
  captures: false,
  stonesPerTurn: 1,
  winLength: 5,
  secondStoneExclusion: 0
}

What it prints (run when this page was built)

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