Search…
N-queens
Overview of the n-queens app.
Note, n-queens is available as an app on GitHub (contact [email protected] for access). You can use it as is or configure it to meet your needs.
The n-queens App places n queens in an n x n chessboard so no queens attack each other by being in the same row, column or diagonal.
The cmd directory in the app folder contains the main.go, cmd.sh and supporting data files needed to run the app.
For n = 1 the problem has a trivial solution and no solution exists for n = 2 and n = 3.
A feasible solution for n = 4 is:
Text
1
- Q - -
2
- - - Q
3
Q - - -
4
- - Q -
Copied!
The following is an infeasible solution because there are queens attacking each other diagonally.
Text
1
- Q - -
2
Q - - -
3
- - - Q
4
- - Q -
Copied!
We are always adding new apps. If you are looking for a new one, email [email protected].
Last modified 6mo ago
Export as PDF
Copy link