diff options
1 files changed, 0 insertions, 38 deletions
| -rw-r--r-- | DiamondProblemAndPolymorphism/Chess/Knight.hpp | 38 |
diff --git a/DiamondProblemAndPolymorphism/Chess/Knight.hpp b/DiamondProblemAndPolymorphism/Chess/Knight.hpp deleted file mode 100644 index 90f93e9..0000000 --- a/DiamondProblemAndPolymorphism/Chess/Knight.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once
-#include "Figure.hpp"
-
-class Knight : public Figure
-{
-public:
- Knight(int xCoordinate, int yCoordinate, bool isWhite) :Figure(xCoordinate, yCoordinate, isWhite)
- {}
-
- bool Move(int xNew, int yNew);
-
- void Print();
-};
-bool Knight::Move(int xNew, int yNew)
-{
- if (!isValidCoord(xNew, yNew))
- return false;
- int possibleX[] = { 1, 1, -1, -1, 2, 2, -2, -2 };
- int possibleY[] = { 2, -2, 2, -2, 1, -1, 1, -1 };
- for (int i = 0; i < 8; ++i)
- {
- if (xNew == xCoord + possibleX[i]
- && yNew == yCoord + possibleY[i])
- {
- xCoord = xNew;
- yCoord = yNew;
- return true;
- }
-
- }
- return false;
-
-}
-
-void Knight::Print()
-{
- cout << 'K';
-}
\ No newline at end of file |
