Skip to content

Solving n-Queens to learn golang and constraint satisfaction problems

License

Notifications You must be signed in to change notification settings

scottfones/goqueens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goqueens

Find solutions to n-Queens Constraint Satisfaction Problems via AC-3 and Backtracking search.

MVC pattern implemented in Golang:

  • main.go
    • Controller connecting the web (View) package with the game (Model) package
  • web package
  • game package
    • Model consists of a Constraint Satisfaction Problem (CSP) with a slice of n queens and a map of constraints
      • Each queen tracks its column, row, and valid domain assignments. It also stores a boolean, moveable, indicating whether the user has restricted its location.
    • A Backtracking search is used to find solutions to the CSP
      • The queen with the most constrained domain is selected for assignment by an MRV heuristic.
      • AC-3 is used to maintain consistency and generate inferences.
      • Solutions are returned to the controller as JSON for display.

To Run:

  1. Download Go
  2. cd into goqueens project directory
  3. Execute go run main.go
  4. Browse to localhost:3000

About

Solving n-Queens to learn golang and constraint satisfaction problems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published