Game.cpp
//
// Game::start_game
// take in a string that represents the name of the game
// if the game pointer is not nullptr, throw game_already_started error
// if not, init game pointer to corresponding game (or throw unknown_game if  
// the game is not recognized)
//

:start_game
take in a string that represents the name of the game
if the game pointer is not nullptr, throw game_already_started error
if not, init game pointer to corresponding game (or throw unknown_game if
the game is not recognized)
: start_game take in a string that represents the name of the game if the game pointer is not nullptr throw game_already_started error if not init game pointer to corresponding game ( or throw unknown_game if the game is not recognized )
void Game::start_game(const string name)
{
	const string fiveCardDrawName = "FiveCardDraw";
	const string sevenCardStudName = "SevenCardStud";
	const string texasHoldEmName = "TexasHoldEm";
	if (game == nullptr) {
		if (name == fiveCardDrawName) {
			game = make_shared<FiveCardDraw>(FiveCardDraw());
		}
		else if (name == sevenCardStudName){
			game = make_shared<SevenCardStud>(SevenCardStud());
		}
		else if (name == texasHoldEmName){
			game = make_shared<TexasHoldEm>(TexasHoldEm());
		}
		else{
			throw errors::unknown_game;
		}
	}
	else {
		throw errors::game_already_started;
	}
}
void Game :: start_game ( const string name ) { const string fiveCardDrawName = " " ; const string sevenCardStudName = " " ; const string texasHoldEmName = " " ; if ( game == nullptr ) { if ( name == fiveCardDrawName ) { game = make_shared < FiveCardDraw > ( FiveCardDraw ( ) ) ; } else if ( name == sevenCardStudName ) { game = make_shared < SevenCardStud > ( SevenCardStud ( ) ) ; } else if ( name == texasHoldEmName ) { game = make_shared < TexasHoldEm > ( TexasHoldEm ( ) ) ; } else { throw errors :: unknown_game ; } } else { throw errors :: game_already_started ; } }
Game::start_game
take in a string that represents the name of the game
if the game pointer is not nullptr, throw game_already_started error
if not, init game pointer to corresponding game (or throw unknown_game if
the game is not recognized)
Game :: start_game take in a string that represents the name of the game if the game pointer is not nullptr throw game_already_started error if not init game pointer to corresponding game ( or throw unknown_game if the game is not recognized )