#ifndef DEF_PIECE_H #define DEF_PIECE_H /* [1] Libs =========================================================*/ /* (1) Internes */ #include #include #include #include /* (2) Externes */ #include "../ChessContext.h" /* (3) Namespace */ using namespace std; /* [2] Enumerations =========================================================*/ enum PIECE_TYPE{ ROI, REINE, CAVALIER, TOUR, FOU, PION }; ostream& operator<<(ostream& o, const PIECE_TYPE& t){ switch(t){ case ROI: return o << "Roi"; break; case REINE: return o << "Reine"; break; case CAVALIER: return o << "Cavalier"; break; case FOU: return o << "Fou"; break; case TOUR: return o << "Tour"; break; case PION: return o << "Pion"; break; } return o << "UNKNOWN"; } // /* [2] Definition =========================================================*/ class Piece{ public: Piece(PIECE_TYPE t, int x, int y); // GETTERS PIECE_TYPE gett() const; int getx() const; int gety() const; static void decode(char *s, int* xy); // SETTERS void move(const int x, const int y); // OPERATEURS (SURCHARGE) friend ostream& operator<<(ostream& o, const Piece& p); // ABSTRACT virtual bool can(const ChessContext& ctx, int x, int y); virtual char getchar(); protected: PIECE_TYPE _t; int _x; int _y; }; /* [n] Inclusion du corps =========================================================*/ // #include "Piece.cpp" #endif