N-Queens Puzzle

This is my solution to the famous 8-Queens Puzzle (and more general N-Queens Puzzle).  “So, what’s the 8-Queens Puzzle?”  you say. “Good question!” I say.  Wikipedia has a ton of information about this and summarizes as follows:

“The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens attack 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 queens on an n×n chessboard, where solutions exist for all natural numbers n with the exception of 2 and 3″

Solutions to N-Queens Puzzles

Continue reading