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
|
||||
# {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
|
||||
def distance(A, B):
|
||||
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)
|
||||
for d in Da:
|
||||
wait(d)
|
||||
assert(Da.len == 0)
|
||||
assert(len(Da) == 0)
|
||||
for d in range(D):
|
||||
if Dd[d] <= t:
|
||||
Da.push(d)
|
||||
|
|
Reference in a new issue