get_result: Get the result of a chess game from SAN format moves

View source: R/get_result.R

get_resultR Documentation

Get the result of a chess game from SAN format moves

Description

This function takes a character string of SAN format chess moves and returns the result of the game.

Usage

get_result(movetext)

Arguments

movetext

A character string of SAN format chess moves.

Details

The functions looks for one of the four possible game termination markers defined by the PGN specification ("0-1", "1-0", "1/2-1/2", or "*") and returns the marker if found. If no marker is found it returns NA.

Value

The termination marker of the game if found, otherwise NA.

Note

If multiple markers are present, only the first one is returned.

Examples

get_result("1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 1-0")
get_result("1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 Nf6 1/2-1/2")

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