aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2017-01-16 01:12:25 +0000
committerymherklotz <ymherklotz@gmail.com>2017-01-16 01:12:25 +0000
commit088b948122cbf24dd9dc1dfedf4be2724bab2157 (patch)
tree4a9610f9ad3e3afbb98510478bd3e2969baad136 /include
parent1f138d96ab7f517e7842710ef3428f67a2965877 (diff)
downloadChessAI-088b948122cbf24dd9dc1dfedf4be2724bab2157.tar.gz
ChessAI-088b948122cbf24dd9dc1dfedf4be2724bab2157.zip
backing up files, with parser changes
Diffstat (limited to 'include')
-rw-r--r--include/board_state_parser.hpp44
-rw-r--r--include/chess_board.hpp4
-rw-r--r--include/chess_piece.hpp16
3 files changed, 45 insertions, 19 deletions
diff --git a/include/board_state_parser.hpp b/include/board_state_parser.hpp
new file mode 100644
index 0000000..39286d4
--- /dev/null
+++ b/include/board_state_parser.hpp
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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 {
+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
diff --git a/include/chess_board.hpp b/include/chess_board.hpp
index fef1f69..d3516fc 100644
--- a/include/chess_board.hpp
+++ b/include/chess_board.hpp
@@ -27,13 +27,11 @@ typedef std::unique_ptr<ChessPiece> chessPiecePtr;
class ChessBoard {
public:
ChessBoard();
- ChessBoard(const ChessBoard& other) = default;
- virtual ~ChessBoard() = default;
void printBoard();
protected:
private:
- static const unsigned CHESS_BOARD_SIZE = 64;
+ static const unsigned BOARD_SIZE = 64;
boardVector board;
};
diff --git a/include/chess_piece.hpp b/include/chess_piece.hpp
index ce6ca5c..5febc99 100644
--- a/include/chess_piece.hpp
+++ b/include/chess_piece.hpp
@@ -35,12 +35,8 @@ class ChessPiece {
public:
// constructor sets the initial position of the chess piece to 0, 0
ChessPiece();
- // using the default constructor for the copy constructor
- ChessPiece(const ChessPiece& other) = default;
// initialise piece at a specific location on the board to save code
ChessPiece(const int& x, const int& y, const Colour& colour);
- // using default virtual d, const Colour &colourfault;
- virtual ~ChessPiece() = default;
// pure virtual function to move a piece as it depends completely on the
// implementation of the piece
@@ -60,9 +56,7 @@ protected:
class King : public ChessPiece {
public:
King();
- King(const King& other) = default;
King(const int& x, const int& y, const Colour& colour);
- ~King() = default;
virtual void move(const int& x, const int& y);
protected:
@@ -75,9 +69,7 @@ private:
class Queen : public ChessPiece {
public:
Queen();
- Queen(const Queen& other) = default;
Queen(const int& x, const int& y, const Colour& colour);
- ~Queen() = default;
virtual void move(const int& x, const int& y);
protected:
@@ -90,9 +82,7 @@ private:
class Rook : public ChessPiece {
public:
Rook();
- Rook(const Rook& other) = default;
Rook(const int& x, const int& y, const Colour& colour);
- ~Rook() = default;
virtual void move(const int& x, const int& y);
protected:
@@ -105,9 +95,7 @@ private:
class Bishop : public ChessPiece {
public:
Bishop();
- Bishop(const Bishop &other) = default;
Bishop(const int& x, const int& y, const Colour& colour);
- ~Bishop() = default;
virtual void move(const int& x, const int& y);
protected:
@@ -120,9 +108,7 @@ private:
class Knight : public ChessPiece {
public:
Knight();
- Knight(const Knight& other) = default;
Knight(const int& x, const int& y, const Colour& colour);
- ~Knight() = default;
virtual void move(const int& x, const int& y);
protected:
@@ -135,9 +121,7 @@ private:
class Pawn : public ChessPiece {
public:
Pawn();
- Pawn(const Pawn& other) = default;
Pawn(const int& x, const int& y, const Colour& colour);
- ~Pawn() = default;
virtual void move(const int& x, const int& y);
protected: