game.h 1.7 KB

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