Initial commit

This commit is contained in:
2026-04-15 08:37:09 -06:00
commit 36edac0355
46 changed files with 18087 additions and 0 deletions

20
examples/NQueens.rp1 Normal file
View File

@@ -0,0 +1,20 @@
; Each possible coordinate on the board.
define output Coord Integer
Coord 1.
Coord a :- Coord b, b < 8, a = b + 1.
; Each possible placement of a queen.
define output decision Queen(Coord, Coord)
Queen(row, col) :- Coord row, Coord col.
; Exactly one queen goes on each row.
:- For(row), @count Queen(row, _) = 1.
; Exactly one queen goes on each column.
:- For(col), @count Queen(_, col) = 1.
; At most one queen can go along each main diagonal.
:- For(diag), @count { Queen (row, col), diag = row + col } <= 1.
; At most one queen can go along each orthogonal diagonal.
:- For(diag), @count { Queen (row, col), diag = row - col } <= 1.