game.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef GAME
  2. #define GAME
  3. #include "qwixx.h"
  4. #include "dice.h"
  5. #include "ScoreSheet.h"
  6. #include <windows.h>
  7. #include <array>
  8. #include <time.h>
  9. #include "fester.h" //temp network library
  10. struct Turn
  11. {
  12. std::array<Move, 2> moves;
  13. // this can be zero, one or two
  14. int numberOfMoves = 0;
  15. bool penalty;
  16. };
  17. class Game {
  18. public:
  19. std::vector<ScoreSheet> players;
  20. std::vector<bool> lockOut;
  21. int lastColumnIndex;
  22. int state;
  23. Dice dice;
  24. int activePlayer;
  25. Game();
  26. void round();
  27. void score();
  28. std::string send();
  29. struct Turn receive(std::string userInput);
  30. // rules as methods of game
  31. bool addPlayer(std::string name);
  32. // rule for lockout to populate a locked out row so score function can check for locked rows
  33. void addX(int player, int color, int index);
  34. bool checkTurn (int player, Turn turn);
  35. // rule for being able to lockout a row, check for last box marked off and set condition where the next box has to be higher than that previous box check
  36. bool lockOutRule(int player, Turn turn);
  37. bool leftToRightRule(int player, Turn turn);
  38. bool isMoveRepresentedInDie(int player, Turn turn);
  39. struct Move Game::translateToMove(std::string temp);
  40. /* TODO: generate a set of all possible moves a player can take given a: ScoreSheet & diceRoll
  41. * 1. one good reason to do this would be to check if a player can make a given move
  42. * 2. if you give this set of moves to an AI, it could pick a move
  43. * 3. could give hints to an end user about what move they can take
  44. */
  45. private:
  46. int entropyPool;
  47. };
  48. #endif