本文へ移動

Suido水道

管を回してポンプと排水口をつなぎます。収録された問題やシード付きの問題で遊べます。

「水道」は、水を届ける設備を表す言葉です。 名前について(英語)

目次

リファレンス · 管・ルール・解法

SolveResult型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What the solver found.

インポート

import type { SolveResult } from "@johnmorrisdotca/suido";

定義

type SolveResult = {
    count: number;
    solutions: number[][];
    nodes: number;
    branches: number;
    forced: number;
    complete: boolean;
};

メンバー

名前型説明
countnumber

How many answers there are, counted up to the limit asked for.

solutionsnumber[][]

Each answer found, as the sides every piece opens on. In a drains board a piece the water does not reach stays as it was given.

nodesnumber

The positions the search looked at, and how many of them had more than one way on to try.

branchesnumber
forcednumber

The pieces fixed by deduction alone, before the search had to guess anything.

completeboolean

False when the budget ran out before the search was finished: count is then only how many were found so far.

例

import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout, solve } from "@johnmorrisdotca/suido";
import type { SolveResult } from "@johnmorrisdotca/suido";

const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
const value: SolveResult = solve(layout,2,20000);
console.log(value);
{
  count: 1,
  solutions: [
    [
       6, 10, 10, 10,  8,  5,  2, 10,
      12,  4,  7, 14, 10, 15, 13,  5,
       3,  8,  1,  5,  3, 10, 10,  8,
       1
    ]
  ],
  nodes: 1,
  branches: 0,
  forced: 25,
  complete: true
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/suido 1.7.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。