Skip to main content

Create a chess board which highlights the squares being attacked by a bishop.

Display a chessboard on your webpage. Below is an example of what a chessboard looks like.

A doc with tags

When the user hovers on any square of the chessboard:

  • Change the color of the square to light blue.
  • Change the color of the squares that would be attacked by a bishop to dark blue. A bishop attacks along its diagonals.

An example of hover state is shown below.

Example Image

tip

Try to play with matrix indices and chessboard squares.