Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Classes | Functions
pgn_move_string.h File Reference
#include "square.h"
#include "piece_type.h"
#include <optional>
#include <string>
Include dependency graph for pgn_move_string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pgn_move_string
 A string that is a PGN notation string. More...
 

Functions

std::optional< piece_typeget_piece_type (const pgn_move_string &pgn_str)
 Get a piece type for a string, if any.
 
std::optional< squareget_square (const pgn_move_string &pgn_str)
 Get the square from a string, if any.
 
std::optional< piece_typeget_promotion_type (const pgn_move_string &pgn_str)
 Get the type the piece is promoted to.
 
std::optional< squareget_to (const pgn_move_string &pgn_str)
 Get the square a piece is moving to, if any.
 
std::vector< chess_colorget_winner (const pgn_move_string &pgn_str)
 Get the winner from a notation.
 
bool is_capture (const pgn_move_string &pgn_str)
 Conclude if the move is a capture from a PGN string E.g.
 
void test_pgn_move_string ()
 
bool operator== (const pgn_move_string &lhs, const pgn_move_string &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const pgn_move_string &s) noexcept
 

Function Documentation

◆ get_piece_type()

std::optional< piece_type > get_piece_type ( const pgn_move_string pgn_str)

Get a piece type for a string, if any.

E.g. 'Nc3' will result in a knight, 'e4' will result in a pawn

◆ get_promotion_type()

std::optional< piece_type > get_promotion_type ( const pgn_move_string pgn_str)

Get the type the piece is promoted to.

Will be empty if this is no promotion

◆ get_square()

std::optional< square > get_square ( const pgn_move_string pgn_str)

Get the square from a string, if any.

E.g. 'Nc3' will result in 'c3'

@seealso same as get_to}

◆ get_to()

std::optional< square > get_to ( const pgn_move_string pgn_str)

Get the square a piece is moving to, if any.

E.g. 'Nc3' will result in 'c3'

@seealso same as get_square}

◆ get_winner()

std::vector< chess_color > get_winner ( const pgn_move_string pgn_str)

Get the winner from a notation.

Assumes a win ('1-0' or '0-1') or a draw ('1/2-1/2').

◆ is_capture()

bool is_capture ( const pgn_move_string pgn_str)

Conclude if the move is a capture from a PGN string E.g.

'Nxc3' will result in true

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const pgn_move_string s 
)
noexcept

◆ operator==()

bool operator== ( const pgn_move_string lhs,
const pgn_move_string rhs 
)
noexcept

◆ test_pgn_move_string()

void test_pgn_move_string ( )