script.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. '''
  2. >> https://www.codingame.com/ide/173171838252e7c6fd6f3ff9cb8169431a08eec1
  3. @author: olivier.massot, may 2019
  4. '''
  5. import sys
  6. import time
  7. debug = True
  8. t0 = time.time()
  9. def log(*msg):
  10. if debug:
  11. print("{} - ".format(str(time.time() - t0)[1:5]), *msg, file=sys.stderr)
  12. class Base():
  13. def __repr__(self):
  14. return f"<{self.__class__.__name__}: {self.__dict__}>"
  15. class Building(Base):
  16. def __init__(self, owner, type_, x, y):
  17. self.x = x
  18. self.y = y
  19. self.owner = owner
  20. self.type_ = type_
  21. class Unit(Base):
  22. def __init__(self, owner, id_, level, x, y):
  23. self.x = x
  24. self.y = y
  25. self.owner = owner
  26. self.id_ = id_
  27. self.level = level
  28. mines = [[int(j) for j in input().split()] for _ in range(int(input()))]
  29. log(f"* mines: {mines}")
  30. while True:
  31. gold, income = int(input()), int(input())
  32. log(f"* gold: {gold} / +{income}")
  33. opponent_gold, opponent_income = int(input()), int(input())
  34. log(f"* opponent's gold: {opponent_gold} / +{opponent_income}")
  35. grid = [input().split() for _ in range(12)]
  36. log("* grid: {}".format("\n".join([" ".join(row) for row in grid])))
  37. buildings = [Building(*[int(j) for j in input().split()]) for _ in range(int(input()))]
  38. log(f"* buildings: {buildings}")
  39. units = [Unit(*[int(j) for j in input().split()]) for _ in range(int(input()))]
  40. log(f"* units: {units}")
  41. print("WAIT")