Chal dev august
8 Queens
This months programming challenge is the 8 queens puzzle. From wikipedia;
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.
Write code to solve the puzzle. Output should be all solutions for n = 8. Solution format is
(2 4 6 8 3 1 7 5)
where squares are numbered starting at 1 from the bottom left. Output to standard out one line per solution. With or without parenthesis.