I was looking at the code, I dont have much time to go through it, but I might have found a typo - yield (p.destination - self.currenteFloor) , I think it should be currentFloor.Maybe thats your problem. Will look into the code more later.
Regards, Nav On 05-Aug-2010, at 12:55 PM, Brandon McCombs wrote: > Hello, > > I'm building an elevator simulator for a class assignment. I recently ran > into a roadblock and don't know how to fix it. For some reason, in my > checkQueue function below, the call to self.goUp() is never executed. It is > on the last line of code I pasted in. I can put print statements before and > after the call and I have a print statement in goUp() itself. Only the print > statements before and after the call are executed. The one inside goUp() is > never executed because goUp() never seems to be executed. How can that be? I > don't get any errors when the script executes. Surely this isn't some > limitation I'm encountering? > > thanks > > sorry about the formatting > > --------------------------------------------- > class Elevator(Process): > def __init__(self,name): > Process.__init__(self,name=name) > self.numPassengers = 0 > self.passengerList = [] > self.passengerWaitQ = [] > self.currentFloor = 1 > self.idle = 1 > self.newPassengers = 0 > def goUp(self): > print "here" > bubbleSort(self.passengerList, len(self.passengerList)) > self.currentFloor += 1 > if len(self.passengerList) > 0: > for p in self.passengerList: > if self.currentFloor == p.destination: > yield (p.destination - self.currenteFloor) * TRAVELTIME, self > reactivate(p) > p.inBuilding() > else: > self.goUp() > > def checkQueue(self): > if (len(self.passengerWaitQ)) > 0 and len(self.passengerList) < > MAXCAPACITY: > if len(self.passengerWaitQ) < MAXCAPACITY: > self.newPassengers = len(self.passengerWaitQ) > else: > self.newPassengers = MAXCAPACITY - len(self.passengerList) > for i in range(0,self.newPassengers): > self.passengerList.append(self.passengerWaitQ.pop()) > self.goUp() > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list