// Definition of Boolean that should work for all systems.
//typedef int Boolean;
//const int TRUE = 1;
//const int FALSE = 0;

// =========================> PROTOTYPES <==============================

//==========================> getInputs <===============================
void 
getInputs(/*out*/ float& aprob,
                  float& bprob,
                  int& num_of_games);
//PRE: cin=[afloat1,afloat2,int1,|stuff]
//      && user enters correct values for afloat1 and afloat2 (0<=afloat<=1)
//      && either or none but not both afloat1 and afloat2 equals 0
//      && user enters a int1 >=0
//      && int1 is entered as an integer that is >=0
//
//POST: aProb=afloat1
//      && bProb=afloat2
//      && num_of_games=aint1
//      && cin=[stuff]
//      && the probablities do not both equal 0
//      && num_of_games>=0

//==========================> playGame <=================================
void
playGame( /* in */ float AProb,     /*Prob that A wins serve*/
                   float BProb,     /*Prob that B wins serve*/
         /* out */ int& AScore,     /*Final score for A*/
                   int& BScore);    /*Final score for B*/
// PRE: (0 <= AProb <= 1) && (0 <= BProb <= 1) &&
//      !(AProb = 0 && BProb = 0)
//POST: ((AScore > BScore) && ((BScore = 21) || ((AScore = 11) &&
//      (BScore = 0)))) ||
//      ((BScore > AScore) && ((AScore = 21) || ((BScore = 11) &&
//      (AScore = 0))))

//=========================> doRally <====================================
void
doRally(/* in  */ float    serverProb,   //Prob that server wins rally
        /*inout*/ int&     serverScore,  //Current score of server
                  Boolean&    aServing);    //TRUE if player A is serving
// PRE:   0 <= serverProb <= 1 &&
//        serverScore and aServing assigned
// POST:  serverProb percent of time serverScore++ &&
//        (1 - serverProb) percent of time aServing = !aServing

//========================> gameOver <=====================================
Boolean 
gameOver(/* in */ int aScore, int bScore);
// PRE: Assigned (aScore) && Assigned (bScore)
// POST: aScore == 11 && bScore == 0 --> FNCVAL == TRUE
//       bScore == 11 && aScore == 0 --> FNCVAL == TRUE
//       aScore == 21 || bScore == 21 --> FNCVAL == TRUE
//       otherwise FALSE

//==================================> serverWins <=========================
Boolean 
serverWins(/* in */ float prob);
// Pre: 0 <= prob <= 1
// Post: FCTVAL == TRUE with probability prob &&
//       FCTVAL == FALSE with probability (1 - prob)
//
// Note: Makes use of pseudo-random number generation from .
//       Different sequences of TRUE/FALSE are obtained by changing
//       the seed value with srand().

//============================> updateStats <================================
void 
updateStats ( /* in */    int aScore,
                          int bScore,
              /* inout */  int& aWins,
                           int& bWins,
                           int& aShuts,
                           int& bShuts);
// PRE:  aScore != bScore && aWins >= 0 && bWins >= 0 &&
//       aShuts >= 0 && bShuts >= 0
// POST: if (aScore > bScore) then aWins += 1
//       else                      bWins += 1
//       if (aScore == 0) then bShuts += 1
//       if (bScore == 0) then aShuts += 1

//===========================> printSummary <=================================
void 
printSummary (/* in */ 
              int aShutout,
              int bShutout,
              int aWin,
              int bWin,
              float aProb,
              float bProb);
//PRE:  Assigned (aShutout) && Assigned (bShutout)  &&
//    Assigned (aWin)   && Assigned (bWin)    &&
//    Assigned (aProb)  && Assigned (bProb)   &&
//POST: cout == [ STUFF | aSutout, bShutout, aWin, bWin, aProb, 
//    a percent of wins, a percent of shutouts, bProb, b percent of wins, 
//    b percent of shutouts ]