# Answer to Question #17503 in Quantitative Methods for Sujata Roy

Question #17503

Describe 4 queen's problem.

Expert's answer

The idea is that we have a 4×4 chess table, and 4 Queen chess pieces. We now have to position those 4 Queens in such a way that there is only one queen per line and none of them are able to capture any other using standard chess moves.

To detect a collision between Queens, we need to check the columns and the diagonals. Collisions can be easily checked if we assign index positions to chess board matrix and keep 3 separate collision lists: one for columns and two for the diagonals. We update the collision lists whenever a Queen is placed. For the column list, we simply add the Queen’s column position; for one diagonal, we add the sum of the Queen’s line with the Queen’s column to the list; and for the other diagonal, we add the subtraction of the line and column position to the list.

To detect a collision between Queens, we need to check the columns and the diagonals. Collisions can be easily checked if we assign index positions to chess board matrix and keep 3 separate collision lists: one for columns and two for the diagonals. We update the collision lists whenever a Queen is placed. For the column list, we simply add the Queen’s column position; for one diagonal, we add the sum of the Queen’s line with the Queen’s column to the list; and for the other diagonal, we add the subtraction of the line and column position to the list.

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment