checkSuidoAnswer関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether an answer solves a board: the check a page makes to say "solved" and a server makes before it trusts a solve. O(cells): one walk of the water, no search.
The answer is a code like the board's own. Every cell of it must be the piece the board has there, turned (a piece is never changed, moved or taken away), and the sources and drains must be where the board put them. Then the water is run from the sources through the answer's pieces, and the board must be solved: a network, every piece wet; drains, every drain wet; and either way no wet piece opens on nothing; an inlet-outlet board also asks that the water runs in one path. Locked pieces must be as the board gives them, and the walls must be the board's walls. A block that turns as one (big pieces and blocks) must be the block the board has there turned a whole number of quarters, never one piece of it turned alone.
It does not ask whether the board is one a site has made: a site that pays or ranks for a solve asks that first.
インポート
import { checkSuidoAnswer } from "@johnmorrisdotca/suido";
定義
function checkSuidoAnswer(board: string, answer: string): SuidoCheck
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | string | The original native board code. |
answer | string | The solved pipe masks or encoded answer specified by the signature. |
戻り値
SuidoCheck
Whether an answer solves a board: the check a page makes to say "solved" and a server makes before it trusts a solve. O(cells): one walk of the water, no search.
例
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { levelAnswer } from "@johnmorrisdotca/suido/levels";
import { checkSuidoAnswer } from "@johnmorrisdotca/suido";
const row = SUIDO_5X5[0];
const code = row[0];
const answer = levelAnswer(row)!;
console.log(checkSuidoAnswer(code,answer));{ ok: true }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。