Reference · Four-neighbour rules
decodeOrthogonalGamefunction
Restores only version 2 orthogonal progress records.
Import it
import { decodeOrthogonalGame } from "@johnmorrisdotca/jirai/orthogonal";
Also exported from: @johnmorrisdotca/jirai
Definition
function decodeOrthogonalGame(code: string): Game | null
Parameters
| Name | Type | Description |
|---|---|---|
code | string | A saved orthogonal game string to validate and replay. |
Returns
Game | null
The validated orthogonal game, or null for invalid data or a different variant.
Examples
import type { OrthogonalSettings } from "@johnmorrisdotca/jirai/orthogonal";
import { play } from "@johnmorrisdotca/jirai";
import { decodeOrthogonalGame, encodeOrthogonalGame, newOrthogonalGame } from "@johnmorrisdotca/jirai/orthogonal";
const orthogonalSettings: OrthogonalSettings={width:3,height:3,mines:1,noGuess:false,opening:"clear",seed:42};
const orthogonalGame=play(newOrthogonalGame(orthogonalSettings),{kind:"reveal",cell:0});
console.log(decodeOrthogonalGame(encodeOrthogonalGame(orthogonalGame))?.status);playingWhat it prints (run when this page was built)