Browse Source

init script

olinox 6 years ago
parent
commit
0e65e117aa
1 changed files with 56 additions and 0 deletions
  1. 56 0
      i_n_f/script.py

+ 56 - 0
i_n_f/script.py

@@ -0,0 +1,56 @@
+'''
+>> https://www.codingame.com/ide/173171838252e7c6fd6f3ff9cb8169431a08eec1
+@author: olivier.massot, may 2019
+'''
+import sys
+import time
+
+
+debug = True
+
+t0 = time.time()
+
+def log(*msg):
+    if debug:
+        print("{} - ".format(str(time.time() - t0)[1:5]), *msg, file=sys.stderr)
+
+class Base():
+    def __repr__(self):
+        return f"<{self.__class__.__name__}: {self.__dict__}>"
+
+
+class Building(Base):
+    def __init__(self, owner, type_, x, y):
+        self.x = x
+        self.y = y
+        self.owner = owner
+        self.type_ = type_
+
+class Unit(Base):
+    def __init__(self, owner, id_, level, x, y):
+        self.x = x
+        self.y = y
+        self.owner = owner
+        self.id_ = id_
+        self.level = level
+
+mines = [[int(j) for j in input().split()] for _ in range(int(input()))]
+log(f"* mines: {mines}")
+
+while True:
+    gold, income = int(input()), int(input())
+    log(f"* gold: {gold} / +{income}")
+    
+    opponent_gold, opponent_income = int(input()), int(input())
+    log(f"* opponent's gold: {opponent_gold} / +{opponent_income}")
+    
+    grid = [input().split() for _ in range(12)]
+    log("* grid: {}".format("\n".join([" ".join(row) for row in grid])))
+    
+    buildings = [Building(*[int(j) for j in input().split()]) for _ in range(int(input()))]
+    log(f"* buildings: {buildings}")    
+
+    units = [Unit(*[int(j) for j in input().split()]) for _ in range(int(input()))]
+    log(f"* units: {units}")   
+    
+    print("WAIT")