aboutsummaryrefslogtreecommitdiffstats
path: root/src/chess_piece.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-02-25 12:59:47 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-02-25 12:59:47 +0000
commitb4336dd8f5bcd7370d9f439ea46829d7fce59e76 (patch)
treef51149312b636317aa72679879360dea26bab63d /src/chess_piece.cpp
parentb39845e0d36e5806b3f4629b1e5eeca4164572c0 (diff)
parent4e79ea68d54305e6705a3a8e83a730508b9f1c1b (diff)
downloadChessAI-master.tar.gz
ChessAI-master.zip
Fixed conflictsHEADmaster
Diffstat (limited to 'src/chess_piece.cpp')
-rw-r--r--src/chess_piece.cpp69
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) {
}