Reference · Pipes, rules and solving
hintForfunction
A piece to turn, for a player who asks for help: the first piece that does
not face as answer says, nearest the pump first (the water's own order), or
null when every piece does. In a drains board a spare piece is never one. In a
block it is the block's anchor, the top left cell, whichever piece is out of place.
Import it
import { hintFor } from "@johnmorrisdotca/suido";
Definition
function hintFor(game: Game, answer: readonly number[]): number | null
Parameters
| Name | Type | Description |
|---|---|---|
game | Game | The current immutable game state. |
answer | readonly number[] | The solved pipe masks or encoded answer specified by the signature. |
Returns
number | null
A piece to turn, for a player who asks for help: the first piece that does not face as answer says, nearest the pump first (the water's own order), or null when every piece does. In a drains board a spare piece is never one. In a block it is the block's anchor, the top left cell, whichever piece is out of place.
Examples
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { levelSolution } from "@johnmorrisdotca/suido/levels";
import { hintFor, newGame } from "@johnmorrisdotca/suido";
const row = SUIDO_5X5[0];
const code = row[0];
const solution = levelSolution(row)!;
const game = newGame(code)!;
console.log(hintFor(game,solution));0What it prints (run when this page was built)