UCILoader 1.1.2
Small C++ library that allows user to connect to a chess engines via UCI protocol.
Loading...
Searching...
No Matches
StandardChess::FenPos Class Reference

Position formatter for arbitrary FEN positions. More...

#include <StandardChess.h>

Inheritance diagram for StandardChess::FenPos:
UCILoader::PositionFormatter

Public Member Functions

 FenPos (const std::string &fen)
 Constructor that stores the FEN string.
 
std::string toFen () const override
 Get the FEN string.
 
std::string toPositionString () const override
 Get the UCI position string.
 
virtual std::string toFen () const =0
 
virtual std::string toPositionString () const =0
 

Detailed Description

Position formatter for arbitrary FEN positions.

Allows specifying any chess position via FEN notation. Implements the PositionFormatter interface for use with engine searches.

Note
FEN validation is not currently implemented - ensure the FEN string is valid

Usage:

// Position after 1.e4 e5
FenPos pos("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1");
auto search = engine->search(params, pos, {});
Position formatter for arbitrary FEN positions.
Definition: StandardChess.h:285
See also
StartPos for the initial position

Constructor & Destructor Documentation

◆ FenPos()

StandardChess::FenPos::FenPos ( const std::string &  fen)
inline

Constructor that stores the FEN string.

Parameters
fenThe FEN notation string for the position

Member Function Documentation

◆ toFen()

std::string StandardChess::FenPos::toFen ( ) const
inlineoverridevirtual

Get the FEN string.

Returns
The FEN string provided at construction

Implements UCILoader::PositionFormatter.

◆ toPositionString()

std::string StandardChess::FenPos::toPositionString ( ) const
inlineoverridevirtual

Get the UCI position string.

Returns
"fen " followed by the FEN string

Implements UCILoader::PositionFormatter.


The documentation for this class was generated from the following file: