Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NETURAL = 0
- ALLY = 1
- ENEMY = 2
- def do_turn(pw):
- if not pw.my_planets():
- return
- if not pw.not_my_planets():
- return
- for planet in pw.my_planets():
- for enemy in get_closest_pl(pw, planet)[:3]:
- if planet.num_ships() > 14:
- pw.issue_order(planet, enemy, planet.num_ships() * 0.5)
- planet.remove_ships(planet.num_ships() * 0.5)
- #print('pppppp:', pw.enemy_planets()[0].planet_id)
- #def defend(pw):
- # for fleet in pw.enemy_fleets():
- # if fleet.owner() == ENEMY and fleet.destination_planet().owner() == ALLY:
- def ships_in_attack(pw, a, p):
- res = p.num_ships()
- if p.owner() == ENEMY:
- res += pw.distance(a, p) * p.growth_rate()
- return res
- def get_closest_pl(pw,pl):
- planets = sorted(pw.not_my_planets(), key=lambda x:(x.growth_rate() / (x.num_ships() * 0.128 + pw.distance(x, pl) * 1.11)), reverse=True)
- return planets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement