# Commits

check...

• Participants
• Parent commits af0bd0c

# File MyBot.py

` `
` `
`   def get_end_rates(self):`
`+    """`
`+    At the end of the simulation, find the total number of ships`
`+    on the planets, and the sum of the growth rates for each player.`
`+`
`+    This assumes all fleets will have landed by max_turn... which`
`+    is probably a bad assumption.`
`+`
`+    Must be called after update_state()`
`+    """`
`+`
`     counts = [0,0,0]`
`     tmp = [(fut[-1][1], fut[-1][2], i, self.pw.planets[i].growth_rate)`
`            for (i,fut) in enumerate(self.futures)`
`            if fut[-1][1] > 0]`
` `
`-    # for (xxxx,xxx,i, xx) in tmp:`
`-    #   self.log_planet_state(i, True)`
`-      `
`     debug("in score_end_count: %s", tmp)`
`+`
`     rates = [0, 0, 0]`
`     for owner, ships, planet, rate  in tmp:`
`       rates[owner] += rate`
`       `
`     `
`   def find_closest_distance(self):`
`-    """Update information about the distance between the players`
`-    must be called after futures is calculated.`
`+    """`
`+    Find the closest distance between me and the enemy.`
`+    Must be called after update_state()`
`     """`
` `
`-    # find the closet from me to the enemy`
`     mine = [idx for idx in self.pidx if self.futures[idx][-1][1] == 1]`
`     enemy = set(idx for idx in self.pidx if self.futures[idx][-1][1] == 2)`
` `
`       for (d, n) in self.pw.planets[m].neighbors:`
`         if d >= best_d: break`
`         if n in enemy:`
`-          self.best_pair = (m, n)`
`           best_d = d`
`     self.closest_distance = best_d`
`     `
`-        `
`+  def update_state(self):`
`+    """`
`+    This is where all of the game state stuff is calculated.`
`+    """`
`+    The ships available for each planet is calculated.  I used`
`+    to c`
`+    if time.time() > self.end_time:`
`       `
`-    `
`-  def update_state(self):`
`-    if time.time() > self.end_time:`
`       raise OutOfTime()`
`     pw = self.pw`
`     self.fleets = load_fleets(pw.planets, pw.fleets, self.max_turn)`