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

replayTimelinefunction

Rebuilds every position a game passed through by replaying its moves.

A stored game is a move list, never a board, so this is the only way to read one back — and because it runs the same engine, a replayed game and a live one can never disagree about what is legal or who has won.

Swap-opening decisions are not stored, so a game with one replays as though the chooser kept their colour: the stones are the same either way.

Import it

import { replayTimeline } from "@johnmorrisdotca/narabe";

Definition

function replayTimeline(game: StoredGame): GameState[]

Parameters

NameTypeDescription
gameStoredGame

The saved settings and move record to rebuild.

Returns

GameState[]

Rebuilds every position a game passed through by replaying its moves. A stored game is a move list, never a board, so this is the only way to read one back — and because it runs the same engine, a replayed game and a live one can never disagree about what is legal or who has won. Swap-opening decisions are not stored, so a game with one replays as though the chooser kept their colour: the stones are the same either way.

Examples

import { replayTimeline } from "@johnmorrisdotca/narabe";

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

What it prints (run when this page was built)

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