Changes
1 changed files (+29/-5)
-
-
@@ -19,7 +19,7 @@ board states. Though, we recommended making a copy of the map to preservethe actual current map state. """ class AlgoStrategy(gamelib.AlgoCore): class AlgoStrategy(gamelib.AlgoCore): def __init__(self): super().__init__() seed = random.randrange(maxsize)
-
@@ -41,7 +41,11 @@ DEMOLISHER = config["unitInformation"][4]["shorthand"]INTERCEPTOR = config["unitInformation"][5]["shorthand"] MP = 1 SP = 0 # This is a good place to do initial setup global damage damage = {SCOUT: 0, DEMOLISHER: 0, INTERCEPTOR: 0} self.scored_on_locations = [] def on_turn(self, turn_state):
-
@@ -79,10 +83,30 @@ self.build_defences(game_state)# Now build reactive defenses based on where the enemy scored self.build_reactive_defense(game_state) if game_state.turn_number % 4 == 0: game_state.attempt_spawn(SCOUT, [14, 0], game_state.number_affordable(SCOUT)) elif game_state.turn_number % 4 == 2: game_state.attempt_spawn(INTERCEPTOR, [14, 0], game_state.number_affordable(INTERCEPTOR)) if game_state.turn_number % 2 == 0: return spawn = None if game_state.turn_number < 6: if game_state.turn_number == 1: spawn = SCOUT elif game_state.turn_number == 3: spawn = INTERCEPTOR elif game_state.turn_number == 5: spawn = DEMOLISHER else: total = damage[SCOUT]+damage[INTERCEPTOR]+damage[INTERCEPTOR] if total == 0: r = random.randint(0, 1) if r == 0: spawn = SCOUT else: spawn = INTERCEPTOR else: r = random.randint(0, total-1) if r < damage[SCOUT]: spawn = SCOUT elif r < damage[SCOUT]+damage[INTERCEPTOR]: spawn = INTERCEPTOR else: spawn = DEMOLISHER damage[spawn] += game_state.enemy_health game_state.attempt_spawn(spawn, [14, 0], game_state.number_affordable(spawn)) damage[spawn] -= game_state.enemy_health ''' # If the turn is less than 5, stall with interceptors and wait to see enemy's base
-