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
| Name | Type | Description |
|---|---|---|
game | StoredGame | 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);2What it prints (run when this page was built)