game.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. struct Turn
  10. {
  11. std::array<Move, 2> moves;
  12. // this can be zero, one or two
  13. int numberOfMoves = 0;
  14. bool penalty;
  15. };
  16. class Game {
  17. public:
  18. std::vector<ScoreSheet> players;
  19. std::vector<bool> lockOut;
  20. int lastColumnIndex;
  21. int state;
  22. Dice dice;
  23. int activePlayer;
  24. Game();
  25. void round();
  26. void score();
  27. std::string send();
  28. struct Turn receive(std::string userInput);
  29. // rules as methods of game
  30. bool addPlayer(std::string name);
  31. // rule for lockout to populate a locked out row so score function can check for locked rows
  32. void addX(int player, int color, int index);
  33. bool checkTurn (int player, Turn turn);
  34. // 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
  35. bool lockOutRule(int player, Turn turn);
  36. bool leftToRightRule(int player, Turn turn);
  37. bool isMoveRepresentedInDie(int player, Turn turn);
  38. struct Move Game::translateToMove(std::string temp);
  39. /* TODO: generate a set of all possible moves a player can take given a: ScoreSheet & diceRoll
  40. * 1. one good reason to do this would be to check if a player can make a given move
  41. * 2. if you give this set of moves to an AI, it could pick a move
  42. * 3. could give hints to an end user about what move they can take
  43. */
  44. private:
  45. int entropyPool;
  46. };
  47. #endif