diff options
fixes
2 files changed, 0 insertions, 37 deletions
| -rw-r--r-- | Sem. 15/Chess/Figures/Knight/Knight.cpp | 26 | ||||
| -rw-r--r-- | Sem. 15/Chess/Figures/Knight/Knight.h | 11 |
diff --git a/Sem. 15/Chess/Figures/Knight/Knight.cpp b/Sem. 15/Chess/Figures/Knight/Knight.cpp deleted file mode 100644 index 5713d7c..0000000 --- a/Sem. 15/Chess/Figures/Knight/Knight.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Knight.h" -#include <cmath> - -Knight::Knight(bool isWhite) : Figure(isWhite, KnightFigure) -{} -bool Knight::canBeMoved(size_t currentX, size_t currentY, size_t destX, size_t destY) const -{ - int xMovеment[] = { 1, 1, -1, -1, 2, -2, 2, -2 }; - int yMovеment[] = { 2, -2, 2, -2, 1, 1, -1, -1 }; - - for (int i = 0; i < 8; i++) - { - if (currentX + xMovеment[i] == destX && - currentY + yMovеment[i] == destY) - return true; - } - return false; -} - -void Knight::print() const -{ - if (getIsWhite()) - std::cout << 'K'; - else - std::cout << 'k'; -}
\ No newline at end of file diff --git a/Sem. 15/Chess/Figures/Knight/Knight.h b/Sem. 15/Chess/Figures/Knight/Knight.h deleted file mode 100644 index 72acfea..0000000 --- a/Sem. 15/Chess/Figures/Knight/Knight.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -#include "../FigureBase/Figure.h" - -class Knight : public Figure -{ - -public: - Knight(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 |
