What is the probability of randomly placing 8 queens on an 8x8 chessboard without any of them being in a position to attack each other?
Instruction: This is a classic puzzle known as the 'eight queens puzzle'. Calculate the probability based on the total number of non-attacking arrangements.
Updated
Example Answer
I would define the random placement first. If we choose eight distinct squares uniformly from all 64 squares, there are C(64, 8) possible placements. Exactly 92 are nonattacking eight-queen placements, counting rotated and reflected boards as distinct. The probability is therefore 92 divided by C(64, 8), about 2.08 times 10 to the minus eight.
If the generator already puts one queen in each row and each column, it samples column permutations instead. There are 8!, or 40,320, such boards, and the probability is 92/40,320, about 0.228%. Those are different experiments. Restricting the denominator to permutations without saying so would greatly overstate the probability for eight uniformly selected squares.
Worked example
C(64, 8) = 4,426,165,368. If only one queen per row is enforced and column choices are independent, the denominator is instead 8^8.
Why this works
It provides a numerical answer while separating the placement rules. The count of 92 includes board symmetries because square selections also distinguish them.
Follow-up to prepare for
A short backtracking search over row-to-column permutations can verify the 92 valid boards by rejecting shared diagonals.
Related Questions
-
medium
-
hard
-
hard