team-remember-to-hydrate / battlecode23-team-remember-to-hydrate

GNU Affero General Public License v3.0
1 stars 0 forks source link

Debugging: Remaining bytecode bot announcements #19

Open mklapp2 opened 1 year ago

mklapp2 commented 1 year ago

Goal: Give bots the ability/directive to announce their remaining bytecode at the end of their turn if it meets a threshold requirement.

Description: The last thing a bot should do before clock.yield is check how much bytecode it has used/remaining. Then if it has less than a set amount remaining (a parameter in RobotPlayer used for all bots, so we change it in one place as desired) it will print that to std. output. We can initially set this to 25% or so and then when we start seeing bots hit the limit we know we need to start looking closely at bytecode usage for that bot type. NOTE: If we overrun the max limit, this statement may not print since the bot would refresh its bytecode amount before it would reach this statement.

Odyhibit commented 1 year ago

I like this during development we could sprinkle that command through the code. It would only trigger on high usage bots. It does cost a little byte code, so we just comment those lines out for turn in.

mklapp2 commented 1 year ago

Even better than commenting the lines out would be having a boolean variable 'debug_bytecost_mode' that is checked at each of those lines so we can toggle it on/off from one known line. I'm not sure if the 'if' statements checking that boolean would incur the same/similar cost as printing the remaining bytecode though.