View source: R/can_king_move.R
king_can_move | R Documentation |
This function checks if the king has any legal moves.
king_can_move(board, color = board$to_move)
can_king_move(board)
board |
A list containing the current state of the chess board. |
color |
An optional character vector giving the color of the king. Defaults to the color of the player whose turn it is to move. |
See fen_to_board()
for details of the chess board format.
This function is used by other functions when testing for checkmate or
stalemate. can_king_move()
is an alias for king_can_move()
.
A logical value indicating whether the king can move. Returns TRUE if the king has at least one valid move, and FALSE otherwise.
board <- fen_to_board() # Starting position
king_can_move(board)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.