This is called the 8-Queens problem and can be generalized to the n-queens problem, the solution is 92 different ways.< <