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

StoredGametype

The stored shape of a game, as both the API and the pages see it.

Import it

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

Definition

type StoredGame = {
    size: number;
    winLength: number;
    variant: string;
    obstacles: string;
    opener: string;
    opening?: string;
    handicap?: Handicap | null;
    headStart?: HeadStart | null;
    seed?: number;
    drawLimit?: string;
    moveTimeMs: number | null;
    moves: MoveInput[];
};

Members

NameTypeDescription
sizenumber
winLengthnumber
variantstring
obstaclesstring
openerstring
opening (optional)string | undefined
handicap (optional)Handicap | null | undefined
headStart (optional)HeadStart | null | undefined

The head start, parsed — see parseHeadStart. Games stored before head starts had none.

seed (optional)number | undefined
drawLimit (optional)string | undefined

See DrawLimit. Games recorded before it existed carry "none", as they were played.

moveTimeMsnumber | null

The clock, or null for none. Required rather than optional: a turn lost to the clock replays only on a record that had one, and a reader that forgot to pass it would cut every such game short at the turn that was lost.

movesMoveInput[]

Examples

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

const stored = {size:15,winLength:5,variant:"freestyle",obstacles:"none",opener:"black",moveTimeMs:null,moves:[{row:7,col:7}]};
const value: StoredGame = stored;
console.log(value);
{
  size: 15,
  winLength: 5,
  variant: 'freestyle',
  obstacles: 'none',
  opener: 'black',
  moveTimeMs: null,
  moves: [ { row: 7, col: 7 } ]
}

What it prints (run when this page was built)

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