A solver for the n-queens problem written in SWI Prolog, as well as a solution verifier written in Go.
First, make sure to install SWI Prolog. Once it's installed:
- Run
swipl
at the command line in theprolog-solver
directory to open the Prolog console. - Run
[solver].
(note the.
) to load the solver program. - Find a solution by running the query
solution(N, Queens).
with N replaced by an actual integer. For example,solution(4, Queens).
will generate a solution with 4 queens for a 4x4 board.
- Hardcode your solution in
go-verifier/main.go
as the value forpossibleSolution
, following the examples there. - In the
go-verifier
directory, rungo run main.go
.