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

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

Strategy: Goal Decay Implementation #30

Open mklapp2 opened 1 year ago

mklapp2 commented 1 year ago

Description: Our bots will probably face scenarios where they attempt to reach a goal and get stuck, perhaps the goal is literally impossible. Bots should set a goal decay timer and if they recognize they have been stuck, give up on the goal and go to a default behavior based on their state and surroundings.

Implementation suggestion: Bots have the following variables: int lastGoalProgressTurn; int closestDistanceReached; int goalTurnsToDecay;

When a bot sets a goal, it updates the lastGoalProgressTurn to the current turn. Every turn if it ends its turn closer to the goal than its closestDistanceReached, it will update those two values accordingly. If the difference between current turn and lastGoalProgressTurn ever exceeds goalTurnsToDecay, the bot gives up on its goal.

Maybe initially we have that goalTurnsToDecay set to 40. Maybe each time we give up, we decrement this by 5 to a minimum of 20 (if a map is a weird maze or otherwise causes us to get 'stuck', it might help to just give up sooner).