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
swiplat the command line in theprolog-solverdirectory 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.goas the value forpossibleSolution, following the examples there. - In the
go-verifierdirectory, rungo run main.go.