Skip to content

arditymeri/NQueensProblem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

N-Queens Problem

Here is a solution to the N-Queens Problem in Java.

How to run

Start the AppSolver class as a Java application. Enter the board size or -1 to exit.

The application prints the total number of solutions, the first 5 solutions, and 5 other random ones. Queen positions are denoted by X, empty positions by 0. Here is an execution example:

N-Queens Problem Solver
Enter N:
15
2279184 solutions found.
The first 5 solutions


	X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15
	0 0 X 0 0 0 0 0 0 0 0 0 0 0 0 14
	0 0 0 0 X 0 0 0 0 0 0 0 0 0 0 13
	0 X 0 0 0 0 0 0 0 0 0 0 0 0 0 12
	0 0 0 0 0 0 0 0 0 X 0 0 0 0 0 11
	0 0 0 0 0 0 0 0 0 0 0 X 0 0 0 10
	0 0 0 0 0 0 0 0 0 0 0 0 0 X 0 9
	0 0 0 X 0 0 0 0 0 0 0 0 0 0 0 8
	0 0 0 0 0 0 0 0 0 0 0 0 X 0 0 7
	0 0 0 0 0 0 0 0 X 0 0 0 0 0 0 6
	0 0 0 0 0 X 0 0 0 0 0 0 0 0 0 5
	0 0 0 0 0 0 0 0 0 0 0 0 0 0 X 4
	0 0 0 0 0 0 X 0 0 0 0 0 0 0 0 3
	0 0 0 0 0 0 0 0 0 0 X 0 0 0 0 2
	0 0 0 0 0 0 0 X 0 0 0 0 0 0 0 1
	a b c d e f g h i j k l m n o 
	================
...

About

Different solutions to N-Queens Problem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages