-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.h
More file actions
34 lines (22 loc) · 913 Bytes
/
Copy pathparser.h
File metadata and controls
34 lines (22 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include <string>
#include <unordered_map>
#include "main.h"
class Parser {
public:
Parser();
int squareFromString(const std::string& sqText) const;
bool parseFen(Position& pos, const std::string& fen);
bool getSquares(int& from, int& to, const std::string& uciMove) const;
private:
static std::vector<std::string> splitDashFen(const std::string& fen);
std::unordered_map<char, int> fileToCol;
void initParser();
int getColor(char color) const;
int getPieceFromToken(const std::string& token) const;
bool isPieceToken(const std::string& token) const;
bool parseBoard(Position& pos, const std::string& boardToken) const;
void parseCastlingRights(Position& pos, const std::string& ks, const std::string& qs) const;
bool parseEnPassant(Position& pos, const std::string& epToken) const;
static std::string trim(const std::string& s);
};