Technologies Used: Python
The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n queens problem of placing n non-attacking queens on an n×n chessboard, for which solutions exist for all natural numbers n with the exception of n=2 and n=3.
Independently developed a program that solves the nQueens problem efficiently up to 1 million queens. Reads input (# of queens to place) from text file "nqueens.txt", and outputs to text file "nqueens_out.txt".
Solving Time:
1,000,000 queens = 180 - 240 seconds (3 - 4 mins)
500,000 queens = 60 - 70 seconds
250,000 queens = 20 - 25 seconds
100,000 queens = 4 - 10 seconds
50,000 queens = 2 - 3 seconds
<50,000 queens = 0 - 2 seconds (with <10,000 queens = < 1 second)
Note: Times will vary depending on the machine you run this program on