|  | @@ -163,28 +163,93 @@ void Game::receive(std::string userInput)
 | 
											
												
													
														|  |   * 
 |  |   * 
 | 
											
												
													
														|  |   * ## Things we need to know ##
 |  |   * ## Things we need to know ##
 | 
											
												
													
														|  |   * sum of both white die
 |  |   * sum of both white die
 | 
											
												
													
														|  | - * 8 sums of each of the white die and all of the colored die
 |  | 
 | 
											
												
													
														|  | - * who is the active player for this turn
 |  | 
 | 
											
												
													
														|  | 
 |  | + * sums of 8 dice
 | 
											
												
													
														|  | 
 |  | + * who is active player
 | 
											
												
													
														|  |   * 
 |  |   * 
 | 
											
												
													
														|  |   * ## How to do ##
 |  |   * ## How to do ##
 | 
											
												
													
														|  |   * on a given turn, sum the white die and sum each of the white die and all of the colored die
 |  |   * on a given turn, sum the white die and sum each of the white die and all of the colored die
 | 
											
												
													
														|  |   * check to see if each players' requested move is valid
 |  |   * check to see if each players' requested move is valid
 | 
											
												
													
														|  | - *      does the player's requested move match the sum of the white die "satisfies all players can do white die combination"
 |  | 
 | 
											
												
													
														|  | - *      if the active player, check both white die and the color die they requested for move
 |  | 
 | 
											
												
													
														|  | - *      TODO: deal with subtley of active player not being able to re-use dice
 |  | 
 | 
											
												
													
														|  | - *      record if active player took at least a white dice move, a colored die move, or both
 |  | 
 | 
											
												
													
														|  | - * if it is valid, add it to player card
 |  | 
 | 
											
												
													
														|  | 
 |  | + *      - does their input match the sum of the white die
 | 
											
												
													
														|  | 
 |  | + * check to see if active player requested move is valid
 | 
											
												
													
														|  | 
 |  | + *      - for the active player check white die sum if one input. if it fails then check each white die + color die sums add item to scoresheet
 | 
											
												
													
														|  | 
 |  | + *      - for the active player if two inputs are passsed, check white die sum first if it passes, add to scoresheet. then check the second input with white die + colored die
 | 
											
												
													
														|  | 
 |  | + * if it is valid, add it to player card 
 | 
											
												
													
														|  |   * if it is not valid, return an error to player
 |  |   * if it is not valid, return an error to player
 | 
											
												
													
														|  | 
 |  | + * 
 | 
											
												
													
														|  | 
 |  | + * ## players' move 
 | 
											
												
													
														|  | 
 |  | + * // this function has access to diceRoll and player input
 | 
											
												
													
														|  | 
 |  | + * // is the players' input a valid move <- what does valid mean? (is it represented in die, does it follow left to right, does it follow lockout, does it fit within the confines of a move)
 | 
											
												
													
														|  | 
 |  | + * // the confines of a move for non-actie player is (0 or one white die move)
 | 
											
												
													
														|  | 
 |  | + * // the confines of a move for active palyer is (penalty or (one or two die moves))
 | 
											
												
													
														|  | 
 |  | + * 
 | 
											
												
													
														|  | 
 |  | + * // 
 | 
											
												
													
														|  |   */
 |  |   */
 | 
											
												
													
														|  | -void Game::addX(int player, int color, int index)
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +bool Game::isMoveRepresentedInDie(int player, CollectionOfMoves collectionOfMoves)
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  | 
 |  | +    // is this the non-active player
 | 
											
												
													
														|  | 
 |  | +    if(player != activePlayer) 
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        // if the move equals the sum of the two white die return true, if not return false
 | 
											
												
													
														|  | 
 |  | +        return (collectionOfMoves.white.index == (dice.dice[white1] + dice.dice[white2])) ?  true : false;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    // otherwise this is the active player
 | 
											
												
													
														|  | 
 |  | +    else
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        // if one move
 | 
											
												
													
														|  | 
 |  | +        if(1 == collectionOfMoves.numberOfMoves)
 | 
											
												
													
														|  | 
 |  | +        { 
 | 
											
												
													
														|  | 
 |  | +            // check sum of white die
 | 
											
												
													
														|  | 
 |  | +            if(collectionOfMoves.white.index != (dice.dice[white1] + dice.dice[white2]))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                int c = collectionOfMoves.color.color;
 | 
											
												
													
														|  | 
 |  | +                // if any white die plus the colored die equals the move
 | 
											
												
													
														|  | 
 |  | +                if(collectionOfMoves.color.index == (dice.dice[white1] + dice.dice[c]) || collectionOfMoves.color.index == (dice.dice[white2] + dice.dice[c]))
 | 
											
												
													
														|  | 
 |  | +                {
 | 
											
												
													
														|  | 
 |  | +                    return true;
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                // colored die plus either white die was not a move
 | 
											
												
													
														|  | 
 |  | +                else {return false;}
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            // otherwise the white sum die was a move
 | 
											
												
													
														|  | 
 |  | +            else {return true;}
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        // if two move 
 | 
											
												
													
														|  | 
 |  | +        else if(2 == collectionOfMoves.numberOfMoves)
 | 
											
												
													
														|  | 
 |  | +        {            
 | 
											
												
													
														|  | 
 |  | +            // check first input with white die sum
 | 
											
												
													
														|  | 
 |  | +            if(collectionOfMoves.white.index != (dice.dice[white1] + dice.dice[white2]))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                // white die sum was not a move
 | 
											
												
													
														|  | 
 |  | +                return false;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            else
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                    int c = collectionOfMoves.color.color;
 | 
											
												
													
														|  | 
 |  | +                // check to see if color die + either white die sum equals a move
 | 
											
												
													
														|  | 
 |  | +                if(collectionOfMoves.color.index == (dice.dice[white1] + dice.dice[c]) || collectionOfMoves.color.index == (dice.dice[white2] + dice.dice[c]))
 | 
											
												
													
														|  | 
 |  | +                {
 | 
											
												
													
														|  | 
 |  | +                    return true;
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                else {return false;}
 | 
											
												
													
														|  | 
 |  | +            }           
 | 
											
												
													
														|  | 
 |  | +                
 | 
											
												
													
														|  | 
 |  | +        }           
 | 
											
												
													
														|  | 
 |  | +    }      
 | 
											
												
													
														|  | 
 |  | +};
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +void Game::lockOutRule(int player, int color, int index)
 | 
											
												
													
														|  |  {
 |  |  {
 | 
											
												
													
														|  | -    /* TODO: check that index and color match rolled die
 |  | 
 | 
											
												
													
														|  | -    * ## Rule Check ##
 |  | 
 | 
											
												
													
														|  | -    * if index is not the sum of two dice throw an error
 |  | 
 | 
											
												
													
														|  | -    * if index is a sum AND color is correct allow it
 |  | 
 | 
											
												
													
														|  | -    */
 |  | 
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    // player can add an x to olok in last column if there are 5 x
 |  | 
 | 
											
												
													
														|  | 
 |  | + // player can add an x to olok in last column if there are 5 x
 | 
											
												
													
														|  |      if(lastColumnIndex == index)
 |  |      if(lastColumnIndex == index)
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |          if(LOCKOUT_QUALIFIER >= players[player].cumulativeOlok.getXCount(color))
 |  |          if(LOCKOUT_QUALIFIER >= players[player].cumulativeOlok.getXCount(color))
 | 
											
										
											
												
													
														|  | @@ -193,10 +258,18 @@ void Game::addX(int player, int color, int index)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          else{fprintf(stdout, "Player[%d] %s tried to check off column 12 without minimum X\n", player, players[player].savedName);}
 |  |          else{fprintf(stdout, "Player[%d] %s tried to check off column 12 without minimum X\n", player, players[player].savedName);}
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    // player must add an x to olok from left to right
 |  | 
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +void Game::leftToRightRule(int player, int color, int index)
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  | 
 |  | +     // player must add an x to olok from left to right
 | 
											
												
													
														|  |      if(players[player].cumulativeOlok.getLastIndex(color) > index)
 |  |      if(players[player].cumulativeOlok.getLastIndex(color) > index)
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |          fprintf(stdout,"Player[%d] %s not following left to right rule X\n", player, players[player].savedName);
 |  |          fprintf(stdout,"Player[%d] %s not following left to right rule X\n", player, players[player].savedName);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      else{players[player].currentTurnOlok.addX(color, index);}
 |  |      else{players[player].currentTurnOlok.addX(color, index);}
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +void Game::addX(int player, int color, int index)
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  |  }
 |  |  }
 |