Reference · Four-neighbour rules
encodeOrthogonalGamefunction
Encodes an orthogonal game with an explicit variant marker and version 2.
Import it
import { encodeOrthogonalGame } from "@johnmorrisdotca/jirai/orthogonal";
Also exported from: @johnmorrisdotca/jirai
Definition
function encodeOrthogonalGame(game: Game): string
Parameters
| Name | Type | Description |
|---|---|---|
game | Game | The native game, or answer-free VisibleGame required by the signature. |
Returns
string
Encodes an orthogonal game with an explicit variant marker and version 2.
Examples
import type { OrthogonalSettings } from "@johnmorrisdotca/jirai/orthogonal";
import { play } from "@johnmorrisdotca/jirai";
import { 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(encodeOrthogonalGame(orthogonalGame));{"version":2,"variant":"orthogonal","settings":{"width":3,"height":3,"mines":1,"noGuess":false,"opening":"clear","seed":42,"grid":"orthogonal"},"moves":[{"kind":"reveal","cell":0}],"helped":false}What it prints (run when this page was built)