Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 18, 2015 20:12
Embed
What would you like to do?
# (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