Bit of debug
This commit is contained in:
parent
1c42ca8ccb
commit
b73e39775a
22
main.py
22
main.py
|
@ -37,6 +37,26 @@ Cp = []; # Positions of customers
|
||||||
Ci = []; # Needs of customers
|
Ci = []; # Needs of customers
|
||||||
# {product number: qt}
|
# {product number: qt}
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
|
||||||
|
assert(len(Dp) == len(Di) == len(Dd) == len(Da) == D)
|
||||||
|
assert(len(Pw) == P)
|
||||||
|
assert(len(Wp) == len(Wi) == W)
|
||||||
|
assert(len(Cp) == len(Ci) == C)
|
||||||
|
|
||||||
|
#def droneInfos(d):
|
||||||
|
# print("- Drone", d, "carries", ", ".join([p + ": " + q + "×" + Dw[p] for
|
||||||
|
|
||||||
|
def showGrid():
|
||||||
|
for y in range(Y):
|
||||||
|
for x in range(X):
|
||||||
|
if (x, y) in Wp:
|
||||||
|
print("W", end="")
|
||||||
|
if (x, y) in Cp:
|
||||||
|
print("C", end="")
|
||||||
|
else:
|
||||||
|
print("·", end="")
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
def distance(A, B):
|
def distance(A, B):
|
||||||
return math.ceil(sqrt(pow((B[0] - A[0], 2) + pow(B[1] - A[1], 2))))
|
return math.ceil(sqrt(pow((B[0] - A[0], 2) + pow(B[1] - A[1], 2))))
|
||||||
|
@ -89,7 +109,7 @@ def newTurn():
|
||||||
print("--- Turn", t)
|
print("--- Turn", t)
|
||||||
for d in Da:
|
for d in Da:
|
||||||
wait(d)
|
wait(d)
|
||||||
assert(Da.len == 0)
|
assert(len(Da) == 0)
|
||||||
for d in range(D):
|
for d in range(D):
|
||||||
if Dd[d] <= t:
|
if Dd[d] <= t:
|
||||||
Da.push(d)
|
Da.push(d)
|
||||||
|
|
Reference in a new issue