Puzzle | Minimum colors required to color a chessboard with no two given pair threatening each other
For each of the following chess pieces, find the minimum number of colors needed to color an N x N chessboard, such that no pair placed on two squares of the same color can threaten each other:
- The knight
- The bishop
- The king
- The rook
The knight in a chessboard threatens any square that is two squares horizontally and one square vertically, or two squares vertically and one square horizontally from the square it occupies.
As depicted in the figure, on the standard chessboard, a knight in a white square can only attack black square and vice-versa. Hence, for the knight, the minimum number of colors is 2 for N > 2. It is 1 for N = 2, as no two knights can threaten each other on such a small board.
The bishop is the one that threatens any square which is on the same diagonal.
Now, since there are N squares on the main diagonal, hence at least N colors are required to color the squares of the diagonal so that no bishops on the diagonal threaten each other. To extend this coloring to the entire board, we can color either the columns or the row, with the same color, as its square lying on the main diagonal. In this way, all the diagonals will have different colored squares, so no two bishops lying on two same-colored squares will threaten each other.
All the squares that are horizontally, vertically or diagonally adjacent to the square of the king, are threatened by it.
Consider a 2 x 2 chessboard, with a king in its lower-left corner. Since such a king would threaten all the remaining squares on the board. Hence, 4 colors will be needed to color a 2 x 2 board.
To color an N x N chessboard, we can consider it as being made up 2 x 2 boards, and coloring each 2 x 2 board with the same coloring scheme, will ensure that no two kings on the same-colored squares threaten each other. Hence, the number of colors for the king is 4.
A rook threatens every square that lies on the same row or column, on the chessboard.
To ensure that a rook doesn’t threaten anyone in its row or column, N colors are required. Also, N colors are sufficient to color the entire board, using a simple coloring scheme. Color the first row with N different colors. For each subsequent row to be colored, circularly shift the colors by one position, left or right, so that no row contains the same color twice.