metalevel.at
Solving N-queens with Prolog
https://www.metalevel.at/queens
Solving N-queens with Prolog. The task is to place N queens on an N×N chessboard in such a way that none of the queens is under attack. It is easy to describe solutions. Of this task, using CLP(FD) constraints. Which are commonly used for combinatorial tasks. Full code: queens.pl. You can use SWI-Prolog. 5650 to try it. Start it with:. You can then run queries like:. N = 8, n queens(N, Qs), labeling([ff], Qs). N = 20, n queens(N, Qs), labeling([ff], Qs). N = 100, time( n queens(N,Qs),labeling([ff],Qs) ).
metalevel.at
Presprover
https://www.metalevel.at/presprover
Presprover — Prove formulas of Presburger arithmetic. Source code: presprover.pl. To try it, download SWI-Prolog. A few example queries and their results:. Valid(exists(x, x 0) . true? Valid(forall(x, exists(y, 3*x y 2) ). true? Valid(2*y 3*x = 30 / x = 0 = y = 15). true. Please see the source file for more information.
metalevel.at
Alzint
https://www.metalevel.at/alzint
Alzint — An interpreter for AL(Z) programs. Source code: alzint.pl. You need SWI Prolog. AL(Z) stands for Assignment Language over Integers. It is a Turing complete. Programming language supporting variable assignments, loops and conditions. Is an interpreter for AL(Z) programs, written in Prolog. Alzint lets you run AL(Z) programs. It also supports single-stepping and reverse execution. Of AL(Z) programs. This means that previous steps of the execution can be undone. For single-stepping, use.
metalevel.at
Closed Knight's Tour in Prolog
https://www.metalevel.at/knight
Closed Knight's Tour in Prolog. Prolog code: knight.pl. This solution uses CLP(FD) constraints. To model the problem. In particular, the. Constraint is used to describe a Hamiltonian path. 580 (recommended: latest git version). Start it with. Example queries that you can try:. N tour(N, Ts), maplist(label, Ts)? N tour(N, Ts), maplist(label, Ts), print tour(Ts)? Show(8, [ff], Ts)? Show(N, [ff], Ts), print tour(Ts). Sample pictures for N = 6, 8, 12, 16:.