Pella86

GameEngine.h

Jan 11th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. #ifndef GAMEENGINE_H
  2. #define GAMEENGINE_H
  3.  
  4. #include <iostream>
  5. #include <sstream>
  6. #include <string>
  7.  
  8. #include "Board.h"
  9.  
  10. enum PlayerID {
  11.     pNONE,
  12.     HUMAN,
  13.     CPU
  14. };
  15.  
  16.  
  17. class Player{
  18. public:
  19.     virtual ColorID const& getColor() const = 0;
  20.     virtual std::string mkMove() const = 0;
  21.     virtual std::string selectUnit() const = 0;
  22.     virtual std::string printPlayer() =0;
  23. };
  24.  
  25.  
  26. class HPlayer : public Player {
  27. private:
  28.     ColorID color;
  29.     PlayerID pID;
  30. public:
  31.     HPlayer(ColorID col):color(col),pID(HUMAN){}
  32.     HPlayer():color(WHITE),pID(HUMAN){}
  33.    
  34.     ColorID const& getColor() const{return color;}
  35.    
  36.     std::string selectUnit() const;
  37.     std::string mkMove() const;
  38.     std::string printPlayer();
  39. };
  40.  
  41. class CPUPlayer : public Player {
  42. private:
  43.     ColorID color;
  44.     PlayerID pID;
  45. public:
  46.     CPUPlayer(ColorID col):color(col),pID(CPU){}
  47.     CPUPlayer():color(WHITE),pID(CPU){}
  48.    
  49.    
  50.     ColorID const& getColor() const{return color;}
  51.    
  52.     std::string selectUnit() const;
  53.     std::string mkMove() const;
  54.     std::string printPlayer();
  55. };
  56.  
  57. class GEngine {
  58. private:
  59.     ChessBoard board;
  60.     Player* p1;
  61.     Player* p2;
  62.     void setPlayers();
  63. public:
  64.     GEngine();
  65.    
  66.     void printBoard();
  67.     void gameLoop();
  68.     bool isValidMove(std::string mv, Player* p);
  69.     void printPlayers() const;
  70. };
  71.  
  72. #endif
Advertisement
Add Comment
Please, Sign In to add comment