hintYajilinfunction
Find a native Yajilin hint, or null when no actionable hint is available.
Import it
import { hintYajilin } from "@johnmorrisdotca/kazu/yajilin";
Also exported from: @johnmorrisdotca/kazu
Definition
function hintYajilin(game: YajilinGame): { type: "shade"; cell: number; } | { type: "edge"; edge: number; } | null
Parameters
| Name | Type | Description |
|---|---|---|
game | YajilinGame | The current immutable game state. |
Returns
{ type: "shade"; cell: number; } | { type: "edge"; edge: number; } | null
Find a native Yajilin hint, or null when no actionable hint is available.
Examples
import type { YajilinBoard } from "@johnmorrisdotca/kazu/yajilin";
import { hintYajilin, newYajilin } from "@johnmorrisdotca/kazu/yajilin";
const yajilinBoard: YajilinBoard = {"width":5,"height":5,"clues":[{"direction":"left","count":0},null,{"direction":"right","count":1},null,{"direction":"up","count":0},null,null,null,null,null,{"direction":"right","count":0},null,{"direction":"left","count":0},null,{"direction":"down","count":1},{"direction":"left","count":0},null,null,null,null,null,{"direction":"up","count":1},{"direction":"down","count":0},null,{"direction":"down","count":0}]};
const yajilinGame = newYajilin(yajilinBoard);
console.log(hintYajilin(yajilinGame));{ type: 'shade', cell: 1 }What it prints (run when this page was built)