Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- class Units:
- def __init__(self, unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2):
- self.unit_id = unit_id
- self.unit_type = unit_type
- self.x = x
- self.y = y
- self.vx = vx
- self.vy = vy
- self.water = extra
- self.radius = radius
- # game loop
- while True:
- wreckunsort = []
- wreck = []
- threat = 0
- my_score = int(input())
- enemy_score_1 = int(input())
- enemy_score_2 = int(input())
- my_rage = int(input())
- enemy_rage_1 = int(input())
- enemy_rage_2 = int(input())
- unit_count = int(input())
- for i in range(unit_count):
- unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2 = input().split()
- unit_id = int(unit_id)
- unit_type = int(unit_type)
- player = int(player)
- mass = float(mass)
- radius = int(radius)
- x = int(x)
- y = int(y)
- vx = int(vx)
- vy = int(vy)
- extra = int(extra)
- extra_2 = int(extra_2)
- if unit_id == 0:
- reaper = Units(unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2)
- if unit_id == 1:
- reaper1 = Units(unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2)
- if unit_id == 2:
- reaper2 = Units(unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2)
- elif unit_type == 4:
- wreckunsort.append(Units(unit_id, unit_type, player, mass, radius, x, y, vx, vy, extra, extra_2))
- for i in wreckunsort:
- dy = i.y - reaper.y
- dx = i.x - reaper.x
- d1x = i.x - reaper1.x
- d1y = i.y - reaper1.y
- d2x = i.x - reaper2.x
- d2y = i.x - reaper2.y
- if round(math.sqrt(abs(d1x)^2 + abs(d1y)^2)) < i.radius:
- threat +=1
- if round(math.sqrt(abs(d2x)^2 + abs(d2y)^2)) < i.radius:
- threat +=1
- score = ((math.sqrt(abs(dx)^2 + abs(dy)^2))/i.water)/threat*2
- i.score = score
- wreck.append(i)
- wreck.sort(key=lambda x: x.score)
- target = wreck[0]
- dy = target.y - reaper.y
- dx = target.x - reaper.x
- dist = round(math.sqrt(abs(dx)^2 + abs(dy)^2))
- if dist > target.radius:
- print(target.x,target.y, 300)
- else:
- print(target.x,target.y, 200)
- # Write an action using print
- # To debug: print("Debug messages...", file=sys.stderr)
- print("WAIT")
- print("WAIT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement