View source: R/move_exposes_king.R
move_exposes_king | R Documentation |
This function creates a copy of the board and simulates a move. It then checks if the same-color king would be in check after the move.
move_exposes_king(board, coordinates, new_coordinates, color)
board |
A list containing the current state of the chess board. |
coordinates |
A vector of length 2 representing the coordinates of the piece on the board before the move. The first element is the row number and the second element is the column number. |
new_coordinates |
A vector of length 2 representing the coordinates of the piece on the board after the move. The first element is the row number and the second element is the column number. |
color |
A character vector giving the color of the piece. |
A Boolean indicating whether the move results in check.
board <- fen_to_board()
move_exposes_king(board, c(2, 1), c(3, 1), 'white')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.