________________________________________________________________________

This file is part of Logtalk <http://logtalk.org/>  

Logtalk is free software. You can redistribute it and/or modify it under
the terms of the FSF GNU General Public License 3  (plus some additional
terms per section 7).        Consult the `LICENSE.txt` file for details.
________________________________________________________________________


% start by loading the example:

| ?- logtalk_load(clp_yap(loader)).
...


% change the default term writing depth:

| ?- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), max_depth(50), priority(699)]).
true.


| ?- puzzle::solve(Sum=Rs), label(Rs).
[9, 5, 6, 7]+[1, 0, 8, 5]=[1, 0, 6, 5, 2]
Sum = [9, 5, 6, 7]+[1, 0, 8, 5],
Rs = [1, 0, 6, 5, 2] .


| ?- hexagon::mhex(Vs).
Vs = [3, 17, 18, 19, 7, 1, 11, 16, 2, 5, 6, 9, 12, 4, 8, 14, 10, 13, 15] ;
Vs = [3, 19, 16, 17, 7, 2, 12, 18, 1, 5, 4, 10, 11, 6, 8, 13, 9, 14, 15] ;
Vs = [9, 11, 18, 14, 6, 1, 17, 15, 8, 5, 7, 3, 13, 4, 2, 19, 10, 12, 16] ;
(etc)


| ?- soduku::sudoku(Rows), append(Rows, Vs), label(Vs).
Rows = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9, 1, 2, 3], [7, 8, 9, 1, 2, 3, 4, 5, 6], [2, 1, 4, 3, 6, 5, 8, 9, 7], [3, 6, 5, 8, 9, 7, 2, 1, 4], [8, 9, 7, 2, 1, 4, 3, 6, 5], [5, 3, 1, 6, 4, 2, 9, 7, 8], [6, 4, 2, 9, 7, 8, 5, 3, 1], [9, 7, 8, 5, 3, 1, 6, 4, 2]],
Vs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 1, 2, 3, 7, 8, 9, 1, 2, 3, 4, 5, 6, 2, 1, 4, 3, 6, 5, 8, 9, 7, 3, 6, 5, 8, 9, 7, 2, 1, 4, 8, 9, 7, 2|...] ;
Rows = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9, 1, 2, 3], [7, 8, 9, 1, 2, 3, 4, 5, 6], [2, 1, 4, 3, 6, 5, 8, 9, 7], [3, 6, 5, 8, 9, 7, 2, 1, 4], [8, 9, 7, 2, 1, 4, 3, 6, 5], [5, 3, 1, 6, 4, 2, 9, 7, 8], [6, 4, 8, 9, 7, 1, 5, 3, 2], [9, 7, 2, 5, 3, 8, 6, 4, 1]],
Vs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 1, 2, 3, 7, 8, 9, 1, 2, 3, 4, 5, 6, 2, 1, 4, 3, 6, 5, 8, 9, 7, 3, 6, 5, 8, 9, 7, 2, 1, 4, 8, 9, 7, 2|...] ;
(etc)


| ?- soduku::(problem(1, Rows), sudoku(Rows)), append(Rows, Vs), label(Vs).
Rows = [[1, 5, 6, 8, 9, 4, 3, 2, 7], [9, 2, 8, 7, 3, 1, 4, 5, 6], [4, 7, 3, 2, 6, 5, 9, 1, 8], [3, 6, 2, 4, 1, 7, 8, 9, 5], [7, 8, 9, 3, 5, 2, 6, 4, 1], [5, 1, 4, 9, 8, 6, 2, 7, 3], [8, 3, 1, 5, 4, 9, 7, 6, 2], [6, 9, 7, 1, 2, 3, 5, 8, 4], [2, 4, 5, 6, 7, 8, 1, 3, 9]],
Vs = [1, 5, 6, 8, 9, 4, 3, 2, 7, 9, 2, 8, 7, 3, 1, 4, 5, 6, 4, 7, 3, 2, 6, 5, 9, 1, 8, 3, 6, 2, 4, 1, 7, 8, 9, 5, 7, 8, 9, 3, 5, 2, 6, 4, 1, 5, 1, 4, 9|...] .


% the following two queries implies that Ghostscript is available from the command-line:

| ?- soduku::(problem(1, Rows), show([ff], Rows)).
Rows = [[1, 5, 6, 8, 9, 4, 3, 2, 7], [9, 2, 8, 7, 3, 1, 4, 5, 6], [4, 7, 3, 2, 6, 5, 9, 1, 8], [3, 6, 2, 4, 1, 7, 8, 9, 5], [7, 8, 9, 3, 5, 2, 6, 4, 1], [5, 1, 4, 9, 8, 6, 2, 7, 3], [8, 3, 1, 5, 4, 9, 7, 6, 2], [6, 9, 7, 1, 2, 3, 5, 8, 4], [2, 4, 5, 6, 7, 8, 1, 3, 9]] .


| ?- soduku::show([ff], Rows).
Rows = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9, 1, 2, 3], [7, 8, 9, 1, 2, 3, 4, 5, 6], [2, 3, 1, 6, 7, 4, 8, 9, 5], [8, 7, 5, 9, 1, 2, 3, 6, 4], [6, 9, 4, 5, 3, 8, 2, 1, 7], [3, 1, 7, 2, 6, 5, 9, 4, 8], [5, 4, 2, 8, 9, 7, 6, 3, 1], [9, 6, 8, 3, 4, 1, 5, 7, 2]] ;
Rows = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9, 1, 2, 3], [7, 8, 9, 1, 2, 3, 4, 5, 6], [2, 3, 1, 6, 7, 4, 8, 9, 5], [8, 7, 5, 9, 1, 2, 3, 6, 4], [6, 9, 4, 5, 3, 8, 2, 1, 7], [3, 1, 7, 2, 6, 5, 9, 4, 8], [5, 4, 8, 3, 9, 1, 6, 7, 2], [9, 6, 2, 8, 4, 7, 5, 3, 1]] ;
Rows = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9, 1, 2, 3], [7, 8, 9, 1, 2, 3, 4, 5, 6], [2, 3, 1, 6, 7, 4, 8, 9, 5], [8, 7, 5, 9, 1, 2, 3, 6, 4], [6, 9, 4, 5, 3, 8, 2, 1, 7], [3, 1, 7, 2, 6, 5, 9, 4, 8], [9, 6, 2, 8, 4, 7, 5, 3, 1], [5, 4, 8, 3, 9, 1, 6, 7, 2]] ;
(etc)


| ?- queens::n_queens(8, Qs), labeling([ff], Qs).
Qs = [1, 5, 8, 6, 3, 7, 2, 4] ;
Qs = [1, 6, 8, 3, 7, 4, 2, 5] ;
Qs = [1, 7, 4, 6, 8, 2, 5, 3] ;
(etc)


% the following query implies that Ghostscript is available from the command-line:

| ?- queens::show(8, [ff], Qs).
Qs = [1, 5, 8, 6, 3, 7, 2, 4] ;
Qs = [1, 6, 8, 3, 7, 4, 2, 5] ;
Qs = [1, 7, 4, 6, 8, 2, 5, 3] ;
(etc)


| ?- queens::show(N, [ff], Qs).
N = 1,
Qs = [1] ;
N = 4,
Qs = [2, 4, 1, 3] ;
N = 4,
Qs = [3, 1, 4, 2] ;
N = 5,
Qs = [1, 3, 5, 2, 4] ;
(etc)


| ?- oneground::oneground(X, Y, Z), Y = 5.
Y = 5,
Z = 1,
X in inf..sup.
