def tick(self, time_diff):
     """Some time has passed; decide what to do next."""
     self.time_since_last_shot += time_diff
     mytanks, othertanks, flags, shots = self.bzrc.get_lots_o_stuff()
     self.mytanks = mytanks
     self.othertanks = othertanks
     self.flags = flags
     self.shots = shots
     self.enemies = [tank for tank in othertanks if tank.color !=
                     self.constants['team']]
     self.commands = []
     if not self.has_printed:
         graph.create_v_graph(self.obstacles, mytanks[0].x, mytanks[0].y, 0,-375, True)
         self.has_printed = True
     shoot = self.time_since_last_shot > 1.5
     if shoot:
         self.time_since_last_shot = 0
     for tank in mytanks:
         print tank.index
         if tank.status == 'dead' and not self.was_tank_dead(tank):
             self.dead_tanks.append(tank)
         if self.tank_goals.get(tank.index, None)==None or (self.was_tank_dead(tank) and tank.status == 'alive'):
             print tank.status
             self.tank_alive_again(tank)
             self.get_goal(tank)
         self.calc_potential_fields(tank)
         #break
     results = self.bzrc.do_commands(self.commands)
 def get_goal(self, tank):
     if tank.flag != "-":
         self.tank_goals[tank.index] = self.our_base.rectangle.center
     else:
         #possible goals: one of enemy flags (presumably in base)
         count = len(self.flags)
         goal_index = random.randint(0,count-2)
         if self.flags[goal_index].color ==  self.constants['team']:
             goal_index = count-1
         self.tank_goals[tank.index] = [self.flags[goal_index].x,self.flags[goal_index].y]
     path = graph.create_v_graph(self.obstacles, tank.x, tank.y, self.tank_goals[tank.index][0],self.tank_goals[tank.index][1])
     print path
     self.tank_paths[tank.index] = path