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

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

Debugging: Indicator String Policy #42

Open mklapp2 opened 1 year ago

mklapp2 commented 1 year ago

Goal: Have a good way to toggle indicator strings on/off.

Description: Indicator strings help us debug. They also give our opponents a window into how our bots work. Furthermore, they can also be annoying if the ones you care about aren't the most commonly active ones. It would be nice if we could have categories of indicator strings, and wherever we use them we have an if statement checking if that string should display or not. When we submit code, we always turn them all off (but leave them in place so we can keep using them later).

Implementation Proposal: Have a section at the top of RobotPlayer that has some booleans for different indicator strings. One is boolean allIndicatorsOn. Others can be named for each Class file to toggle indicators in that file on or off (ex: launcherIndicatorsOn). As needed, add more specific indicator strings in addition to the Class file ones (ex: launcherTargetingIndicatorsOn). Every indicator string will be inside an if statement like this: if (allIndicatorsOn || || ) {then display indicator}. The specificIndicatorOn is optional and only if you need more granular focus on that specific indicator string. It could be named after a method, a state we want to check for, or perhaps it is an indicator flag used for a group of indicators that need to be used together to debug a behavior.

Odyhibit commented 1 year ago

I am defining a string at the top, and building the string as the logic progresses, setting it at the end. That gives you just one place in the code to toggle it, and allows multiple sections of code to add something to the indicator. I did watch a couple of replays, and did not see any indicator strings for our team, or the enemy team. Did you remove them from the bot submitted? If you did not, then they may be filtering those for us already.

mklapp2 commented 1 year ago

I think you are correct that in the official replays they scrub the strings for us already. I like your idea of building the string since I think that there may be some use cases where it is useful to have a compound message. I also think having variables to toggle individual messages or sections of messages on and off could be useful. I was about to start implementing this now but I will hold off since it sounds like you have an implementation ready.