40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#ifndef ChessPiece_ChessPiecePosition_H
|
|
#define ChessPiece_ChessPiecePosition_H
|
|
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
class ChessPiecePosition {
|
|
private:
|
|
char _file;
|
|
int _rank;
|
|
static const char _MOVE_LEFT = 'L';
|
|
static const char _MOVE_RIGHT = 'R';
|
|
static const char _MOVE_TOP = 'T';
|
|
static const char _MOVE_BOTTOM = 'B';
|
|
void SetFile(char file);
|
|
void SetRank(int rank);
|
|
|
|
public:
|
|
ChessPiecePosition(std::string position);
|
|
ChessPiecePosition(char file, int rank);
|
|
bool operator< (ChessPiecePosition const position) const;
|
|
bool operator== (ChessPiecePosition const position) const;
|
|
static std::string GetDifference(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
|
char GetFile();
|
|
int GetRank();
|
|
static std::string GetStep(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
|
ChessPiecePosition* NextBottom();
|
|
ChessPiecePosition* NextBottomLeft();
|
|
ChessPiecePosition* NextBottomRight();
|
|
ChessPiecePosition* NextFromString(std::string steps);
|
|
ChessPiecePosition* NextLeft();
|
|
ChessPiecePosition* NextRight();
|
|
ChessPiecePosition* NextTop();
|
|
ChessPiecePosition* NextTopLeft();
|
|
ChessPiecePosition* NextTopRight();
|
|
std::string ToString();
|
|
};
|
|
|
|
#endif
|