//====================>  SimStats Implementation <========================
#include 
#include "simstats.h"
#include "rballgame.h"

//====================>  Constructor  <===================================
SimStats::SimStats()
{
	_aWins = _bWins = 0;			//  Initialize Player A & B wins to zero
	_aShuts = _bShuts = 0;			//  Initialize Player A & B shutouts to zero
}

//====================>  Update()  <======================================
void SimStats::Update(RBallGame aGame)
{
	if (aGame.Ascore() > aGame.Bscore())		//  if player A won the game
	{
		_aWins++;								//  increment player A score by one
		
		if (aGame.Bscore() == 0)				//  if it was a shutout
			_aShuts++;							//  increment player A shutouts by one
	}
	else										//  if player B won the game
	{
		_bWins++;								// increment player B score by one
		
		if (aGame.Ascore() == 0)				//  if it was a shutout
			_bShuts++;							//  increment player B shutouts by one
	}
	
	return;
}

//======================>  PrintSummary()  <==============================
void SimStats::PrintSummary()
{
	cout << "Player A won "					//  Player A
		 << _aWins							//  wins
		 << " game(s)."
		 << endl
		 << _aShuts							//  shutouts
		 << " of them were shutouts."
		 << endl
		 << endl
		 << "Player B won "					//  Player B
		 << _bWins							//  wins
		 << " game(s)."
		 << endl
		 << _bShuts							//  shutouts
		 << " of them were shutouts."
		 << endl;
		 
	return;
}