From 01a7f8405dc4c84153344933d695d4ead2f71db5 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Thu, 11 Feb 2016 23:35:05 +0100 Subject: [PATCH] Scores added That'll be enough for tonight. Note that we got 213338 with the following runs 1: 8T/10 2: 8T/10 3: T/2 And we would have been 311 instead of 662 with very few modifications --- Makefile | 4 ++-- main.py | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ace15cd..75ae715 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: 1o 2o 3o ../submission.zip -../submission.zip: - zip $@ .git *.py -r +../submission.zip: 1o 2o 3o + zip $@ .git *o *.py -r 1o: 1 python main.py $< diff --git a/main.py b/main.py index 5f00af4..74029cc 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,7 @@ W = 0 # Nb warehouses C = 0 # Nb customers t = 0 # Turn +s = 0 # Score Dp = [] # Positions of drones # (x, y) @@ -171,6 +172,11 @@ def deliver(d, c, p, q): assert(Dd[d] <= T) print("Drone", d, "delivers", q, "of", p, "to client", c, "→", Dd[d]) Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q)) + # Score + if Ci[c][p] == 0: + global s + s += math.ceil((T-t)/T*100) + def wait(d, w=1): global Dd, Da @@ -230,7 +236,7 @@ for c in range(C): N.append((c, p)) try: - while t < T: + while t < T-100: for d in [d for d in range(D) if Da[d]]: for tk in Dt[d]: c, p = tk @@ -276,3 +282,5 @@ def WarehouseHasItems(w, items): if Wi[w][items[i][0]] < items[i][1]: return False return True + +sys.stdout.write(str(s)+'\n')