Some small cleanup and refactoring.
Update name of a few functions to best suit their usage. Split up checking for winning player and checking for game over state.
This commit is contained in:
parent
d54ccf3d2f
commit
5737ae31be
4 changed files with 21 additions and 14 deletions
|
@ -133,10 +133,8 @@ int main(int argc, char* argv[])
|
|||
snprintf(cmd1,128, "rm -rf %s/*",gameDir.c_str());
|
||||
system(cmd1);
|
||||
|
||||
// While the game hasn't been won
|
||||
player_t winningPlayer;
|
||||
while ( ((winningPlayer = game.CheckForWin()) == player_t::NUM_INVALID) // We have a winning player
|
||||
&& game.GetNumUnits() > 0 ) // We have no units left
|
||||
// While the game isn't finished
|
||||
while ( ! game.GameOver() )
|
||||
{
|
||||
std::cout<<"Starting turn "<<game.GetTurn()<<std::endl;
|
||||
|
||||
|
@ -220,6 +218,9 @@ int main(int argc, char* argv[])
|
|||
// Output final gamestate
|
||||
OutputGameStateFile(game, gameDir);
|
||||
|
||||
// Get the winning player
|
||||
player_t winningPlayer = game.GetWinningPlayer();
|
||||
|
||||
// Print the winner!
|
||||
if ( winningPlayer != player_t::NUM_INVALID )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue