Skip to content

Solving the n-queens problem with Prolog and verifying solutions with Go.

License

Notifications You must be signed in to change notification settings

DylanSp/n-queens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

N-Queens solver and verifier

A solver for the n-queens problem written in SWI Prolog, as well as a solution verifier written in Go.

Finding a solution

First, make sure to install SWI Prolog. Once it's installed:

  1. Run swipl at the command line in the prolog-solver directory to open the Prolog console.
  2. Run [solver]. (note the .) to load the solver program.
  3. 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.

Verifying a solution

  1. Hardcode your solution in go-verifier/main.go as the value for possibleSolution, following the examples there.
  2. In the go-verifier directory, run go run main.go.

About

Solving the n-queens problem with Prolog and verifying solutions with Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published