diff options
Diffstat (limited to 'src/chess_piece.cpp')
-rw-r--r-- | src/chess_piece.cpp | 69 |
1 files changed, 19 insertions, 50 deletions
diff --git a/src/chess_piece.cpp b/src/chess_piece.cpp index f73d4c1..33ce34f 100644 --- a/src/chess_piece.cpp +++ b/src/chess_piece.cpp @@ -1,63 +1,32 @@ -#include "chess_ai.hpp" - -chess_ai::chess_piece::chess_piece(piece_type type, piece_colour colour) : - type(type), colour(colour) { - - if(colour == black) { - y = 0; - } else { - y = 7; - } - - if(type == king) { - x = 4; - } else { - x = 3; - } -} +/* + * + * author: Yann Herklotz + * username: ymherklotz + * email: ymherklotz@gmail.com + * date created: 13/01/17 + * + * ----------------------------------------------------------------------------- + * + * Chess Piece class implementation + * + */ -chess_ai::chess_piece::chess_piece(piece_type type, piece_colour colour, - unsigned x, unsigned y) : - type(type), colour(colour), x(x), y(y) {} +#include "chess_piece.hpp" -chess_ai::chess_piece::~chess_piece() {} +using namespace ymhChessAI; -void chess_ai::chess_piece::set_type(piece_type type) { - this->type = type; -} -void chess_ai::chess_piece::set_colour(piece_colour colour) { - this->colour = colour; +ChessPiece::ChessPiece() : m_x(0), m_y(0), m_colour(Colour::White) { } -void chess_ai::chess_piece::set_x(unsigned x) { - this->x = x; +ChessPiece::ChessPiece(const int& x, const int& y, const Colour& colour) : m_x(x), m_y(y), m_colour(colour) { } -void chess_ai::chess_piece::set_y(unsigned y) { - this->y = y; +EmptyPiece::EmptyPiece() : ChessPiece() { } -void chess_ai::chess_piece::set(piece_type type, piece_colour colour, - unsigned x, unsigned y) { - set_type(type); - set_colour(colour); - set_x(x); - set_y(y); +EmptyPiece::EmptyPiece(const int& x, const int& y) : ChessPiece(x, y, Colour::None) { } -std::string chess_ai::chess_piece::str() { - if(type == empty) - return " "; - else if(type == pawn) - return "p"; - else if(type == rook) - return "r"; - else if(type == knight) - return "n"; - else if(type == bishop) - return "b"; - else if(type == queen) - return "q"; - return "k"; +void EmptyPiece::move(const int& x, const int& y) { } |