OChess v0.0.2
Programmer's Manual
HalfMove Class Reference

This class extends CGEHalfMove (to be displayed in the game editor) More...

#include <HalfMove.hpp>

Inheritance diagram for HalfMove:

Public Member Functions

 HalfMove (HalfMove *m)
 
 HalfMove (std::string move_absolute, std::string move_san)
 
 HalfMove (std::string move_absolute, std::string move_san, std::string fen)
 
 HalfMove (CMI::HalfMove *m)
 
void AddMove (HalfMove *m)
 Add mainline to the current move. If a mainline already exists, add to its variations. More...
 
bool IsVariation ()
 Check if current half move is within a variation.
 
bool HasParent (HalfMove *m)
 Check if pointer m to a HalfMove is a parent of the current one. More...
 
bool HasChild (HalfMove *m)
 Check if a given pointer m to a HalfMove is in mainline or variations of the current move. More...
 
std::vector< HalfMove * > GetLine ()
 Retrieve the list of moves from the current one to the first one.
 
std::string GetLineAsSAN ()
 
std::map< char, std::uint8_t > GetLineCaptures ()
 
void SetOpening (const std::string &name, const std::string &eco)
 The opening name of current line.
 
void GetOpening (std::string &name, std::string &eco)
 Getters for name and eco.
 
std::string GetFen ()
 
void SetFen (std::string fen)
 
void SetCapture (char c)
 
void GetAbsoluteMove (std::string &src, std::string &dst)
 
void SetAbsoluteMove (const std::string &move_absolute)
 
HalfMoveGetCurrentMoveWithFEN (const std::string fen)
 Search if current move (move or its variations) contains a specific fen (usefull to not add moves that already exist) More...
 
void BuildAndVerify (std::string initial_fen)
 Build current move Verify and play all the moves in the game while building the fen for each move.
 

Private Member Functions

void BuildAndVerify (HalfMove *m, std::string fen)
 

Private Attributes

std::string fen
 
char capture
 Used in to retrieve captured pieces (see GetLineCaptures())
 
std::string src
 Store the source and destination square of the current move (mainly used for pieces animation)
 
std::string dst
 
std::string opening
 Opening reach by that move while taking into account all the parents.
 
std::string eco
 
chessarbiter::ChessArbiter arbiter
 Arbiter used to ensure that chess rules are followed.
 

Detailed Description

This class extends CGEHalfMove (to be displayed in the game editor)

Member Function Documentation

◆ AddMove()

void HalfMove::AddMove ( HalfMove m)

Add mainline to the current move. If a mainline already exists, add to its variations.

Parameters
mthe move to add

◆ GetCurrentMoveWithFEN()

HalfMove * HalfMove::GetCurrentMoveWithFEN ( const std::string  fen)

Search if current move (move or its variations) contains a specific fen (usefull to not add moves that already exist)

Parameters
fen
Returns
HalfMove* the move if found or nullptr

◆ HasChild()

bool HalfMove::HasChild ( HalfMove m)

Check if a given pointer m to a HalfMove is in mainline or variations of the current move.

Parameters
m
Returns
true
false

◆ HasParent()

bool HalfMove::HasParent ( HalfMove m)

Check if pointer m to a HalfMove is a parent of the current one.

Parameters
m
Returns
true
false

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