This page contains a script to determine the "rook polynomial" for a chessboard. You can read more about rook polynomials at Wikipedia and MathWorld. Briefly, this counts the numbers of ways to place 0, 1, 2, ... rooks on the chessboard so that no two rooks are in the same row/column. (That is, no rook can capture another.) It is also related to the problem of counting permutations of letters with a given set of restrictions.

Chessboard size:

Rooks may only be placed on black squares. Click a square to change its color.

In the case of the corresponding permutation problem, a black square means that letter is not allowed in that position. For example, if square B3 is black, then B cannot be 3rd in the permutation.

Check this box  to use symmetric restrictions.

Check this box  to select a "derangement" (rooks along the diagonal).

to "collect" groups of squares together.