is_insufficient: Check for draw by insufficient material

View source: R/is_insufficient.R

is_insufficientR Documentation

Check for draw by insufficient material

Description

If mate is impossible due to lack of material, is_insufficient() returns TRUE. In cases where mate is theoretically possible is_insufficient() will return FALSE even if mate can't be forced.

Usage

is_insufficient(board)

Arguments

board

An 8x8 matrix representing the chess board.

Details

Only the following material combinations are considered to be insufficient:

  • King versus king

  • King and bishop versus king

  • King and knight versus king

  • King versus king with any number of bishops on either side, if all bishops are on the same color squares

Value

A Boolean indicating whether there is insufficient material.

Examples

board <- matrix(rep("", 64), nrow = 8)
board[c(1, 64)] <- c("K", "k") # King versus king
is_insufficient(board)

dryguy/rbitr documentation built on Oct. 15, 2024, 6:18 a.m.