Download
language Essence 1.3
$ prob50.essence: N-Queens Problem
$ n: the side length of the board
given n : int(1..)
$ Index: square indicies can be between 1 and n on both axes
letting Index be domain int(1..n)
$ arrangement: one queen is placed on each row, at the column index specified by
$ this function. the bijection ensures each column contains exactly
$ one queen
find arrangement : function (bijective) Index --> Index
$ no queens share diagonals
such that
forAll q1, q2 : Index , q1 < q2 .
|arrangement(q1) - arrangement(q2)| != |q1 - q2|