Metsfanmax wrote:blakebowling wrote:Darwins_Bane wrote:blakebowling wrote:- Code: Select all
if (game_time > 300) game_time = 300;
Try this instead
- Code: Select all
if (300-game_time)>=150) game_time = 300; else game_time=game_time + 150;
I think that is what Seb wanted. regardless. The complaint is that there is too much time currently. perhaps, Mr. adams could you make a poll that reflects some of the suggested modifications listed in this thread?
My code does exactly the same thing yours does. Except yours has extra unnecessary math.
The code for increasing game_time by 150 (or 2.5 minutes) is already there, mine simply makes sure that game_time is NEVER more than 300 (or 5 minutes).
No, Darwin's code does exactly what SirSebstar said. The idea is that if you have between 2:30 and 5:00, your time is reset to 5:00 upon an elimination. If you have less than 2:30 upon an elimination, 2:30 are added (giving you less than 5:00 remaining). Your code does not leave the possibility of having less than 5 minutes remaining immediately after an elimination.
Yes. Darwin's code does what SirSebstar said. However mine does exactly the same thing.
Example 1:
Lets say there are 2:00 left on the game clock when someone is eliminated. The way the current system works, 2:30 would be added to the game clock.
So game_time starts out at 120, when the player elimination is triggered, 150 would be added to the time. Therefore game_time += 150 (120 + 150 = 270) so game_time is now set at 270. THEN, my line of code would be ran:
- Code: Select all
if (game_time > 300) game_time = 300;
Since game_time is 270, which is less than 300, The value does not change.
Example 2:
Lets say there are 3:00 on the game clock when someone is eliminated. The way the current system works, 2:30 would be added to the game clock.
So game_time starts out at 180, when the player elimination is triggered, 150 would be added to the time. Therefore game_time +=150 (180 + 150 = 330) so game_time is now 330. THEN, my line of code would be ran:
- Code: Select all
if (game_time > 300) game_time = 300;
Since game_time is 330, which is greater than 300, the value changes to 300.
Essentially, game_time is 300 or less after my line of code is executed. So the game clock could never have more than 5 minutes on it.
PS: Don't argue with me about coding logic.