Reference · Pipes, rules and solving
Gametype
A game in play: the board as it was given, how every piece faces now, and how far each has been turned in all (kept as a count rather than a facing, so a drawing can turn a piece the way it was tapped, never the long way round).
masks is by where a piece is now; quarters is by the cell the piece was
given in. They are the same cell for every piece but those in a block that
turns as one (blocks.ts), which move round their block: the four pieces of
a block all have the quarters the block has been turned.
Import it
import type { Game } from "@johnmorrisdotca/suido";
Definition
type Game = {
start: Layout;
masks: number[];
quarters: number[];
turns: number;
};
Members
| Name | Type | Description |
|---|---|---|
start | Layout | The board as it was first given. |
masks | number[] | The sides each piece opens on now. |
quarters | number[] | Quarter turns clockwise each piece has had, counting a turn the other way as minus one. |
turns | number | Taps that turned a piece. |
Examples
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { newGame } from "@johnmorrisdotca/suido";
import type { Game } from "@johnmorrisdotca/suido";
const row = SUIDO_5X5[0];
const code = row[0];
const game = newGame(code)!;
const value: Game = game;
console.log(value);{
start: {
width: 5,
height: 5,
kind: 'network',
wrap: false,
cells: [
3, 5, 10, 5, 2, 5, 8, 5,
9, 8, 11, 7, 5, 15, 7, 10,
6, 2, 2, 10, 3, 5, 10, 8,
2
],
sources: [ 0 ],
drains: [
4, 6, 9, 17,
18, 23, 24
]
},
masks: [
3, 5, 10, 5, 2, 5, 8, 5,
9, 8, 11, 7, 5, 15, 7, 10,
6, 2, 2, 10, 3, 5, 10, 8,
2
],
quarters: [
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0
],
turns: 0
}What it prints (run when this page was built)