is_check_cpp | R Documentation |
This function tests if a king is in check.
is_check_cpp(position, p)
position |
An 8 x 8 matrix representing the current position. |
p |
An integer indicating the color of the enemy pieces (1 for white, -1 for black). |
The function looks only at squares from which enemy pieces could
attack the king based on the king's current position. If an attacking
enemy piece is found in one of these squares, the function returns TRUE
.
A Boolean indicating if the king is in check.
# Initialize a chess board
position <- bigchess:::position.start()
# Is the white king in check?
is_check_cpp(position, -1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.