Pella86

Board.h

Jan 11th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #ifndef BOARD_H
  2. #define BOARD_H
  3.  
  4. #include <sstream>
  5. #include "Piece.h"
  6.  
  7. typedef std::pair<int,int> rcPair;
  8.  
  9. std::pair<int,int> rcFromStr(std::string str);
  10. std::string strFromRC(int row, int col);
  11.  
  12.  
  13. class MAPidSTRING{
  14. private:
  15.     std::map<PiecesID,std::string> idToStr;
  16.     std::map<PiecesID,std::string> idToOneLetterStr;
  17.     std::map<ColorID,std::string> idColToStr;
  18. public:
  19.     MAPidSTRING();
  20.     std::string const& operator[](PiecesID ID);
  21.     std::string const& getOneLetterStr(PiecesID ID) {return idToOneLetterStr[ID];}
  22.     std::string const& getColToStr(ColorID ID){return idColToStr[ID];}
  23. };
  24.  
  25. class ChessBoard {
  26. private:
  27.     Piece board[8][8]; //row column
  28.    
  29.     MAPidSTRING idStr;
  30. public:
  31.     ChessBoard();
  32.     Piece const& getPieceAt(int row, int col) const {return board[row][col];}
  33.     bool isEmpty(std::string pos);
  34.     void putPiece(std::string pos, Piece p);
  35.     void removePiece(std::string pos);
  36.     void movePiece(std::string fromTo);
  37.     Piece const& getPieceAt(std::string pos) const;
  38.     rcPair getRowColAt(std::string pos) const;
  39.     void printBoard();
  40. };
  41.  
  42. #endif
Advertisement
Add Comment
Please, Sign In to add comment