chessCAMO
Functions
anonymous_namespace{unit.cpp} Namespace Reference

Functions

string boardFenConverter (Chess &chess)
 Converts a given board position into a FEN string representation. More...
 
void appendFEN (string &fen, int &empty_count, char next_char, bool isWhite)
 Decides what type of character to append to the formed FEN string. More...
 

Function Documentation

◆ boardFenConverter()

string anonymous_namespace unit anonymous_namespace{unit.cpp}::cpp::boardFenConverter ( Chess chess)

Converts a given board position into a FEN string representation.

Parameters
chessThe chess object
Precondition
Start with an initialized board vector
Postcondition
None
Returns
The FEN string based on piece type and common FEN making rules

◆ appendFEN()

void anonymous_namespace unit anonymous_namespace{unit.cpp}::cpp::appendFEN ( string &  fen,
int &  empty_count,
char  next_char,
bool  isWhite 
)

Decides what type of character to append to the formed FEN string.

Parameters
fenThe FEN string that characters will be appended to (can be empty)
empty_countThe number of empty squares found in the current row
[in]next_charThe next character to append to 'fen', must be one of P, N, B, Q, K (upper case)
[in]isWhiteTrue if the passed piece is white, False otherwise. Used to determine piece's letter case in 'fen'.
Precondition
An empty 'fen' string
Postcondition
Appends 'next_char' to 'fen' and returns updated variables by reference