Skip to content

A program that finds the solution to the N Queens Problem.

Notifications You must be signed in to change notification settings

luntropy/n-queens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

N Queens

Purpose

The objective of the program is to find solution to the N Queens problem.

N Queens Problem Wikipedia

Rules

Place N queens on N by N board without them having a conflict with one another.

Goal state example

Goal

About the program

The program uses the algorithm MinConflicts to find the correct solution. The goal is to find a solution of the problem with 10,000 queens under 1 second.

  • There is no solution for the boards: 2x2 and 3x3.

To run the program

  • Build it using make
  • Run ./main
  • Input the number of queens

Output

  • If the number of the queens is 20 or less, the board with the solution will be displayed.
  • If the number of the queens is more than 20, only the elapsed time will be displayed.

Output with 8 queens

Solution-8-queens

Output with 10,000 queens

Solution-10000-queens

About

A program that finds the solution to the N Queens Problem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published