17-03-2018, 12:49 PM
(17-03-2018, 10:05 AM)Kaasovic Wrote:Code:players_alive * 10
players_alive_threshold = players_alive * 8
players_alive_threshold_mod = players_alive_threshold mod 100
players_alive_threshold /= 100
if players_alive_threshold_mod => 50
players_alive_threshold += 1
You should use a ternary conditional operator to simplify this in processing time, memory, and code readability.
Code:
players_alive_threshold = players_alive * 4 / 5
players_alive_threshold = ((players_alive_threshold mod 100) / 100) >= 50 ? players_alive_threshold + 1 : players_alive_threshold;
Voted Friendliest NordInvasion Player
Quote Board is on Discord (last updated 2025.02.02)
"When I feel bad, I read your quote board." - Corndog
Nka: You’re playing it smart, always [using] logic, and they get pissed.
Kaasovic: God, this guy is unbeatable. I feel defeated in every verbal argument we end up in. Good job, Sir.
Odi: Hasn’t [PCK beaten] the game at this point?
Quote Board is on Discord (last updated 2025.02.02)
"When I feel bad, I read your quote board." - Corndog
Nka: You’re playing it smart, always [using] logic, and they get pissed.
Kaasovic: God, this guy is unbeatable. I feel defeated in every verbal argument we end up in. Good job, Sir.
Odi: Hasn’t [PCK beaten] the game at this point?