int totalTimeInSeconds = 29; // add 1 latter for 30 sec
int timeOfTurn = 30;
int numberTurn = totalTimeInSeconds / timeOfTurn; // 0 <-(29sec)
numberTurn += 1; // 1 |
int secondsInTurn = totalTimeInSeconds % 30; // 29sec <--(29 % 30) // add 1 later
if (numberTurn % 2 == 0) // even turns are for player2 and odd for player1
{
std::cout << "It is player2 turn." << std::endl;
}
else // (1 % 2 == 1) and going in here for first turn
{
std::cout << "It is player1 turn." << std::endl;
}
std::cout << "He is in "<< numberTurn << ". turn" << " having done " << secondsInTurn + 1
<<" seconds of the total time " << totalTimeInSeconds + 1 << std::endl;
How does it look? Is it correct? Its a litle tricky to get numbers right and its starts right at first line adding 1 to 29 to get total of 30 seconds that passed.