src = max(gameinfo.my_planets.values(), key=lambda p: p.num_ships)
dest = min(gameinfo.not_my_planets.values(), key=lambda p:p.num_ships)
if len(gameinfo.my_fleets) > 0:
for fleet in gameinfo.my_fleets.values():
print fleet.dest.id
self.dests.append(fleet.dest)
for i, value in self.dests:
print value.id
while value == dest:
self.dests[i] = choice(gameinfo.enemy_planets.values())
for i, fleet in gameinfo.my_fleets.values():
gamefleet.fleet_order(fleet, self.dests[i], int(fleet.num_ships))
# clear for now
self.dests = []
return
问题是最后 2 个 for 循环不确定该做什么……得到一个“不可迭代”的错误。逻辑是正确的,但只是不确定我是否有关键字错误或其他什么。一直在这一切nighttttt!