aboutsummaryrefslogtreecommitdiffstats
path: root/src/pawn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pawn.cpp')
-rw-r--r--src/pawn.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/pawn.cpp b/src/pawn.cpp
new file mode 100644
index 0000000..5c5f1f6
--- /dev/null
+++ b/src/pawn.cpp
@@ -0,0 +1,44 @@
+/*
+ *
+ * author: Yann Herklotz
+ * username: ymherklotz
+ * email: ymherklotz@gmail.com
+ * date created: 13/01/17
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Pawn class implementation, checking if there is a piece in the way of the
+ * one that is currently moving will be the chess boards concern
+ *
+ * Update: Checking if a piece is in the way will be the concern of this class
+ * because the move function has to perform the whole move.
+ *
+ */
+
+#include "chess_piece.hpp"
+#include "chess_constants.hpp"
+
+#include <cmath>
+
+using namespace ymhChessAI;
+
+
+Pawn::Pawn() : ChessPiece() {
+}
+
+Pawn::Pawn(const int& x, const int& y, const Colour& colour) : ChessPiece(x, y, colour) {
+}
+
+void Pawn::move(const int& x, const int& y) {
+ int move_length = y - (int)m_y;
+
+ // First check what colour the pawn is
+ if(m_colour == Colour::White) {
+ // if this condition is met the pawn can move
+ if(move_length == -2 && m_y == ChessConstants::WHITE_PAWN_ROW) {
+ // we now have to check if there is a piece in between the pawn and
+ // it's desination
+ }
+ } else {
+ }
+}