From e71771d48de857ae568b3bf7b591b6be82aceaa4 Mon Sep 17 00:00:00 2001 From: JLo'w Date: Thu, 11 Feb 2016 20:55:22 +0100 Subject: [PATCH 1/3] Add write of drone command to out. --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 968992f..14779ed 100644 --- a/main.py +++ b/main.py @@ -140,6 +140,7 @@ def load(d, w, p, q): assert(weight(d) <= M) assert(Dd[d] <= T) print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d]) + Out.append(str(d) + ' L ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q)) def unload(d, w, p, q): # drone number, warehouse, product, qt @@ -150,6 +151,7 @@ def unload(d, w, p, q): Di[d][p] += -q assert(Dd[d] <= T) print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d]) + Out.append(str(d) + ' U ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q)) def deliver(d, c, p, q): # drone number, customer, product, qt @@ -161,6 +163,7 @@ def deliver(d, c, p, q): Dd[d] += 1 assert(Dd[d] <= T) print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d]) + Out.append(str(d) + ' D ' + str(c+1) + ' ' + str(p+1) + ' ' + str(q)) def wait(d, w=1): assert(d in Da) From 8a19a859d850bde1191960613ec654524fc75f56 Mon Sep 17 00:00:00 2001 From: JLo'w Date: Thu, 11 Feb 2016 20:58:52 +0100 Subject: [PATCH 2/3] All indices start at 0 -_- --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 14779ed..7aeb5cc 100644 --- a/main.py +++ b/main.py @@ -140,7 +140,7 @@ def load(d, w, p, q): assert(weight(d) <= M) assert(Dd[d] <= T) print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d]) - Out.append(str(d) + ' L ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q)) + Out.append(str(d) + ' L ' + str(w) + ' ' + str(p+1) + ' ' + str(q)) def unload(d, w, p, q): # drone number, warehouse, product, qt @@ -151,7 +151,7 @@ def unload(d, w, p, q): Di[d][p] += -q assert(Dd[d] <= T) print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d]) - Out.append(str(d) + ' U ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q)) + Out.append(str(d) + ' U ' + str(w) + ' ' + str(p) + ' ' + str(q)) def deliver(d, c, p, q): # drone number, customer, product, qt @@ -163,7 +163,7 @@ def deliver(d, c, p, q): Dd[d] += 1 assert(Dd[d] <= T) print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d]) - Out.append(str(d) + ' D ' + str(c+1) + ' ' + str(p+1) + ' ' + str(q)) + Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q)) def wait(d, w=1): assert(d in Da) From 5621b6385b9da4a0cc1ab6445668e867e20c2f66 Mon Sep 17 00:00:00 2001 From: JLo'w Date: Thu, 11 Feb 2016 20:59:22 +0100 Subject: [PATCH 3/3] I said ALL --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 7aeb5cc..79386f7 100644 --- a/main.py +++ b/main.py @@ -140,7 +140,7 @@ def load(d, w, p, q): assert(weight(d) <= M) assert(Dd[d] <= T) print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d]) - Out.append(str(d) + ' L ' + str(w) + ' ' + str(p+1) + ' ' + str(q)) + Out.append(str(d) + ' L ' + str(w) + ' ' + str(p) + ' ' + str(q)) def unload(d, w, p, q): # drone number, warehouse, product, qt