Example #1
0
 def load(self, p, dest, warehouseID):
     print self.n, 'L', warehouseID, p, 1
     if(dest not in self.inventory):
         self.inventory[dest] = []
         self.dests.append(dest)
     self.weightLeft -= getProductWeight(p)
     self.inventory[dest].append(p)
Example #2
0
    w = Warehouse(n, x, y, products)
    warehouses.append(w)
    warehouseByPos[x + y * columns] = w

drones = []
for i in range(noOfDrones):
    drones.append(Drone(i, warehouses[0].x, warehouses[0].y, maxLoad))

orders = []
for c in range(int(raw_input())):
    [x, y] = [int(num) for num in raw_input().split(" ")]
    raw_input()
    products = [int(num) for num in raw_input().split(" ")]
    weight = 0
    for product in products:
        weight += utils.getProductWeight(product)
    orders.append(Order(c, x, y, products, weight, warehouses))

currentTurn = 0;
events = {}
eventArgs = {}
def registerEvent(turn, Event, *arg):
    if(turn not in events):
        events[turn] = []
        eventArgs[turn] = []
    events[turn].append(Event)
    eventArgs[turn].append(arg)

def executeEvents(turn):
    if(turn not in events):
        return
Example #3
0
 def unload(self, dest):
     print self.n, 'D', dest.n, self.inventory[dest][0], 1
     for p in self.inventory[dest]:
         self.weightLeft += getProductWeight(p)
     del self.inventory[dest]
Example #4
0
 def canTake(self, product):
     return getProductWeight(product) <= self.weightLeft