Utility class to create a Move from a string. More...
#include <MoveParser.hpp>
Static Public Member Functions | |
static Move< ChessBoard::Coords > | parse (const std::string &input, int moveColor) |
Utility class to create a Move from a string.
The move can have extra spaces, since they are removed before parsing. A move is characterised by two coordinates (in chess notation, e.g. a letter between 'a' and 'h' and a number between 1 and 8. A fifth letter reprentig a piece can be added, for promition. The accepted letters are : 'q' for queen, 'r' for rook, 'b' for bishop and 'n' for knight.
static Move<ChessBoard::Coords> MoveParser::parse | ( | const std::string & | input, | |
int | moveColor | |||
) | [inline, static] |
Extracts a Move for Chessboard from a string In case of failure during the parsing process, an invalid move is returned. The validity can be checkes using isLegal()
input | the string to parse | |
moveColor | the player color initiating the move |