game.h 1.6 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. 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. void 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. // 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
  38. bool Game::lockOutRule(int player, Turn turn);
  39. void leftToRightRule(int player, int color, int index);
  40. bool Game::isMoveRepresentedInDie(int player, Turn turn);
  41. /* TODO: generate a set of all possible moves a player can take given a: ScoreSheet & diceRoll
  42. * 1. one good reason to do this would be to check if a player can make a given move
  43. * 2. if you give this set of moves to an AI, it could pick a move
  44. * 3. could give hints to an end user about what move they can take
  45. */
  46. };
  47. #endif