diff options
fixes
2 files changed, 0 insertions, 31 deletions
| -rw-r--r-- | Sem. 15/Chess/Figures/Pawn/Pawn.cpp | 20 | ||||
| -rw-r--r-- | Sem. 15/Chess/Figures/Pawn/Pawn.h | 11 |
diff --git a/Sem. 15/Chess/Figures/Pawn/Pawn.cpp b/Sem. 15/Chess/Figures/Pawn/Pawn.cpp deleted file mode 100644 index 347032b..0000000 --- a/Sem. 15/Chess/Figures/Pawn/Pawn.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "Pawn.h" -#include <cmath> -Pawn::Pawn(bool isWhite) : Figure(isWhite, PawnFigure), isFirstMove(true) -{} - -bool Pawn::canBeMoved(size_t currentX, size_t currentY, size_t destX, size_t destY) const -{ - if (getIsWhite()) - return currentY - 1 == destY && abs((int)currentX - (int)destX) <= 1; - else - return currentY + 1 == destY && abs((int)currentX - (int)destX) <= 1; -} - -void Pawn::print() const -{ - if (getIsWhite()) - std::cout << 'P'; - else - std::cout << 'p'; -}
\ No newline at end of file diff --git a/Sem. 15/Chess/Figures/Pawn/Pawn.h b/Sem. 15/Chess/Figures/Pawn/Pawn.h deleted file mode 100644 index 675bf0b..0000000 --- a/Sem. 15/Chess/Figures/Pawn/Pawn.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -#include "../FigureBase/Figure.h" - -class Pawn : virtual public Figure -{ - bool isFirstMove; -public: - Pawn(bool isWhite); - bool canBeMoved(size_t currentX, size_t currentY, size_t destX, size_t destY) const override; - void print() const override; -};
\ No newline at end of file |
