is_san: Check if a string contains chess moves in standard algebraic...

View source: R/is_san.R

is_sanR Documentation

Check if a string contains chess moves in standard algebraic notation (SAN)

Description

The function uses regular expressions to check if the string's tokens match the expected pattern for chess moves in SAN.

Usage

is_san(movetext)

Arguments

movetext

A character string, possibly containing a series of chess moves in SAN.

Details

Before making the check, an attempt is made to remove annotations, game termination markers, or other content that would disrupt the regular expression pattern. Note that this function does not check if the moves are legal.

Value

TRUE if the string contains chess moves in SAN format, FALSE otherwise.

Examples

is_san("1. e4! {best by test} e5 2. Nf3 {black resigns in shame} 1-0")
is_san("e2e4 e7e5 g1f3")


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