Created
March 18, 2015 20:12
-
-
Save lettergram/961c558f172c25ff3f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (Index * 5 seconds) + (20 seconds * (Index - PrevIndex)) | |
# If previous elevators loops/stops add up to be greater than, | |
# (timePerFloor * 2) + timePerWait, then increase floor of previous | |
# elevators loop. i.e. elevator[2]+=1 | |
# e represents elevatorArray | |
def addFloor(e): | |
best = 99999 | |
for i in range(1, len(e)): | |
cirTime, avgCarry = eleLoop(e, i) | |
if cirTime + ((cirTime / 100) * avgCarry) < best: | |
elevatorNumber = i | |
best = cirTime + ((cirTime / 100) * avgCarry) | |
for i in range(elevatorNumber, len(e)): | |
e[i] += 1 | |
return e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment