Given an 8x8 chess board, on which 8 queens are available in any 8 positions with the constraint that each column has at least one queen. For example, as shown below.
Heuristic function h (x) is defined as the number of queens that can attack each other, directly or indirectly. For example, the upper left state h (x) = 17, the right state has h (x) = 1.
Requirements: With the given state as above of the chess board. Calculate the value of the function h (x) in the cells of the matrix when moving the queens to that position. Know that in any state of the board, queens can be moved vertically from the position where they are standing.