View source: R/get_legal_moves.R
get_legal_moves | R Documentation |
Generates a list of all legal moves from the provided chess position.
get_legal_moves(position, engine_path)
position |
A single-element character vector containing a sequence of moves in long algebraic notation (LAN). |
engine_path |
A single-element character vector of the path to a UCI compatible chess engine. |
The function get_legal_moves()
passes the position to an external
UCI compatible chess
engine, which must be supplied by the user. The path to the engine's
executable file is given by the engine_path parameter. The engine is asked
to return an analysis with minimum depth, and maximum number of principal
variations (PVs). The legal moves are obtained by parsing the PV output. If
the number of PVs given by the engine is limited, then it is possible that
not every possible legal move will be generated.
The position to be analyzed is represented as a sequence of legal chess moves. As a consequence, it is not possible to generate moves for positions that can not be arrived at by a sequence of legal moves.
A character vector containing all of the legal moves in a position in long algebraic notation (LAN).
# Show all possible white first moves
#' # Modify engine_path as required for your engine location & operating system
engine_path <- '//stockfish.exe'
get_legal_moves('', engine_path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.