Browse Source

create checkTurn method as a wrapper around the rules for a turn.

wes 4 years ago
parent
commit
d0d2fd4ab2
3 changed files with 9 additions and 1 deletions
  1. 6 0
      Qwixx/game.cpp
  2. 1 0
      Qwixx/game.h
  3. 2 1
      Qwixx/toDo.md

+ 6 - 0
Qwixx/game.cpp

@@ -267,6 +267,12 @@ bool Game::leftToRightRule(int player, Turn turn)
     return true;
 }
 
+bool Game::checkTurn (int player, Turn turn)
+{
+    // check all rules for turn verification
+    return lockOutRule( player, turn) && leftToRightRule( player, turn) && isMoveRepresentedInDie(player, turn);
+}
+
 void Game::addX(int player, int color, int index)
 {
 }

+ 1 - 0
Qwixx/game.h

@@ -34,6 +34,7 @@
         bool addPlayer(std::string name);
         // rule for lockout to populate a locked out row so score function can check for locked rows
         void addX(int player, int color, int index);
+        bool checkTurn (int player, Turn turn);
         // 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
         bool lockOutRule(int player, Turn turn);
         bool leftToRightRule(int player, Turn turn);

+ 2 - 1
Qwixx/toDo.md

@@ -30,7 +30,8 @@
     - before writing received create the rules that will affect receive function (e.g. which checkboxes are allowed to be clicked)
     - ~~(20AUG09) TODO: check that index and color, match rolled die (this will help finish addx) then continue work on send/receive~~
     - ~~(20AUG11) TODO: write psuedo code for line 170-175 (174 specifically) in game.cpp~~
-    - (20AUG13) TODO: fix the leftToRightRule and the lockoutRule functions to return bools and change parameters so they use collectionOfMoves. create master function for to call all rules - remove addx dependencies from currentTurnOlok
+    - ~~(20AUG13) TODO: fix the leftToRightRule and the lockoutRule functions to return bools and change parameters so they use collectionOfMoves.~~
+        1. create master function for to call all rules - remove addx dependencies from currentTurnOlok
     - (20AUG13) TODO: refactor dice so it is not vector of ints and add different property to access the die
     - (20AGU13) TODO: receive should parse input and create a collectionOfMoves from it
 - current make process involves compiling all object files from dice, game, playercard to create main.exe which has to be manually linked to these objects. update makefile to support object file code