get_position: Generate a position from movetext

View source: R/get_position.R

get_positionR Documentation

Generate a position from movetext

Description

This function accepts a string containing chess moves in Standard Algebraic Notation (SAN), and an integer specifying a number of ply. It returns a shorter string of chess moves in Long Algebraic Notation (LAN).

Usage

get_position(movetext, ply)

Arguments

movetext

A string containing chess moves in SAN.

ply

An integer specifying a number of ply.

Details

Positions are represented by the series of chess moves that led to the position. The ply parameter specifies which position should be represented in LAN.

This function is useful for generating positions to be analyzed by a chess engine. The initial position is represented by an empty string "".

The function assumes the input to be valid SAN conforming to the PGN specification. It does not validate the input or check for legal chess moves.

Value

A character vector of chess positions.

Examples

movetext <- "1. e4 e5 2. Nf3 Nc6 3. Bb5 a6"
get_position(movetext, 3)


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