aboutsummaryrefslogtreecommitdiffstats
path: root/include/board_state_parser.hpp
blob: d4940db62770615f75cef48e58225d601d69875d (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
/*
 *
 * author: Yann Herklotz
 * username: ymherklotz
 * email: ymherklotz@gmail.com
 * date created: 15/01/17
 *
 * -----------------------------------------------------------------------------
 *
 * Parser that takes in the board state and outputs it into a format that the
 * Chess Board class can read
 *
 */

#ifndef YMH_BOARD_STATE_PARSER_HPP
#define YMH_BOARD_STATE_PARSER_HPP

#include <string>
#include <vector>
#include <fstream>

namespace ymhChessAI {
class BoardStateParser;

typedef std::vector<std::string> boardStateData;

class BoardStateParser {
public:
	BoardStateParser();
	BoardStateParser(const std::string& boardFileName);
	~BoardStateParser();

	void populateBoardState();

	static unsigned stringToInt(const std::string& str);
	static std::string getStateFromLine(const std::string& str);
protected:
private:
	static const unsigned BOARD_SIZE = 64;

	boardStateData boardStateVector;
	std::ifstream boardFile;
};
}

#endif