The goal of the task is to arrange 8x8 N rooks on a chessboard so that they cannot beat each other. The task states should be formalized as a list of elements of the form XY (here the minus is used as a dash) - coordinates of the rooks standing on the board. The initial state is an empty list. The target state is a list of N items. Transitions between states consist in putting on the board a new boat, provided that it does not beat the existing ones. As a solver, use a simple search in depth. The solution will be the view of the target state. Experimentally determine the maximum possible N for which the problem still has a solution, as well as determine the number of possible solutions (i.e. collect all the solutions in the list and measure the length of this list using findall and length). I will be glad to any ideas.

    1 answer 1

    Decision:

    The maximum number of non-attacking rooks on a chessboard is eight, placing them on one of the main diagonals.

    The question is: "in how many ways can eight rooks be placed on an 8 × 8 chessboard, so that none of them attack the other?"

    Answer: "it is obvious that each row and each column should have a rook. Starting from the bottom row, it is clear that the first rook can be placed on any of eight different squares. Wherever it is placed, there is a possibility of seven squares for the second rook in the second Then there are six squares, from which you need to select the third row, five in the fourth and so on. Therefore, the number of different paths should be 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320 "(i.e., 8 ! where "!" is factorial). "