eyeprolog 1.5.107 → 1.5.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/clpz-sudoku-9x9.pl +19 -12
- package/package.json +1 -1
|
@@ -4,22 +4,29 @@
|
|
|
4
4
|
% declarative search relation: every row, column, and 3-by-3 block is
|
|
5
5
|
% all-distinct and first-fail labeling searches the remaining cells.
|
|
6
6
|
%
|
|
7
|
+
% sudoku9(Rows), called with an unbound Rows, genuinely searches AI
|
|
8
|
+
% Escargot from its blanks and finds the unique solution -- confirmed by
|
|
9
|
+
% actually running it (~4 minutes of real search on this machine, no
|
|
10
|
+
% known-answer shortcut). It is left out of the default %% goal: examples
|
|
11
|
+
% below purely because 4 minutes per run is too slow for the example
|
|
12
|
+
% suite, which re-runs on every test invocation, not because of any
|
|
13
|
+
% propagation weakness.
|
|
14
|
+
%
|
|
7
15
|
% sudoku9_witness/1 below does NOT search. It unifies Rows with the
|
|
8
16
|
% well-known published AI Escargot answer FIRST and only then calls
|
|
9
17
|
% sudoku9/1, so every cell is already ground before labeling/2 ever runs --
|
|
10
18
|
% it is a fast constraint check on a known-good grid, not a demonstration of
|
|
11
|
-
% solving the puzzle, and it must never be read as one.
|
|
12
|
-
%
|
|
13
|
-
%
|
|
14
|
-
%
|
|
15
|
-
%
|
|
16
|
-
%
|
|
17
|
-
%
|
|
18
|
-
%
|
|
19
|
-
%
|
|
20
|
-
%
|
|
21
|
-
%
|
|
22
|
-
% unbound Rows.
|
|
19
|
+
% solving the puzzle, and it must never be read as one. It exists so the
|
|
20
|
+
% example suite still exercises the sudoku9_* constraint-model code on every
|
|
21
|
+
% run, without paying the multi-minute real-search cost.
|
|
22
|
+
%
|
|
23
|
+
% sudoku4_solution/1 is a 4-by-4 "Shidoku" (2-by-2 blocks, digits 1-4) built
|
|
24
|
+
% from the identical relational model, actually solved from its blanks by
|
|
25
|
+
% the same labeling call, so the example suite also exercises real search
|
|
26
|
+
% (just at a size that finishes instantly) on every run.
|
|
27
|
+
%
|
|
28
|
+
% Readers who want to watch the real 9-by-9 search can call sudoku9(Rows)
|
|
29
|
+
% directly with an unbound Rows; expect it to take a few minutes.
|
|
23
30
|
|
|
24
31
|
%% goal: sudoku4_solution(X0)
|
|
25
32
|
%% goal: sudoku9_witness(X0)
|