1
1

game.cpp 693 B

1234567891011121314151617181920212223242526272829
  1. #include "qwixx.h"
  2. #include "dice.h"
  3. #include "playerCard.h"
  4. class Game {
  5. public:
  6. std::vector<PlayerCard> players;
  7. int state;
  8. Dice dice;
  9. // rules as methods of game
  10. bool addPlayer(std::string name);
  11. };
  12. Game::Game() {
  13. // set the state of game
  14. state = NOT_STARTED;
  15. // dice have been initialized with random seed
  16. };
  17. bool Game::addPlayer(std::string name){
  18. if (NOT_STARTED == state){
  19. PlayerCard newplayer(name);
  20. players.push_back(newplayer);
  21. fprintf (stdout, "added: %s to the game", name);
  22. return true;
  23. }
  24. else{
  25. fprintf(stdout, "player %s was not added to the game", name);
  26. return false;
  27. }
  28. };