In the modern chess play the queen piece has the most power, as it can move along the diagonals, the verticals and the horizontals. It thus combines the power of the bishop piece and the rook piece. Instead of playing chess the chess board can also be used to pose riddles. One such riddle asks for the placement of nine queens so that they don’t attack each other. Here is a solution on the 4x4 checker board:
The solution algorithm works similar to the solution algorithm for the Sieve of Eratosthenes in that occupied places are crossed out. The difference is that backtracking is involved in the placement of the queens and that we do not represent the whole board. Only the distinct positions of the placed queens are remembered in a list, which makes the check for horizontal and vertical obsolete. The diagonal check is then implemented via arithmetic.
One test iteration will compute all 352 solutions for the 9x9