Statistics: Posted by Iszh — 11 Mar 2016, 12:26
Statistics: Posted by nine2 — 10 Mar 2016, 23:14
Statistics: Posted by TheKoopa — 10 Mar 2016, 14:16
Statistics: Posted by Exotic_Retard — 10 Mar 2016, 14:13
Statistics: Posted by Lionhardt — 10 Mar 2016, 04:08
Statistics: Posted by Lionhardt — 10 Mar 2016, 03:05
Statistics: Posted by Exotic_Retard — 10 Mar 2016, 02:46
# assume each unit takes up 1 slot
# assume each transport has the same number of slots
from collections import deque
units = deque([0,1,2,3,4,5,6,7,8,9])
transports = [[],[],[]]
###########################################################
def load(transport, units):
transport.append(units.popleft())
done = False
while not(done):
for t in transports:
if not(len(units) == 0):
load(t, units)
else:
done = True
###########################################################
for t in transports:
print t
###########################################################
# Output:
# [0,3,6,9]
# [1,4,7]
# [2,5,8]
# what normally happens:
# [0,3,6,9]
# [1,4,7,2]
# [5,8]
Statistics: Posted by Lionhardt — 10 Mar 2016, 01:51
Statistics: Posted by mirroredwang — 01 Mar 2016, 18:03
Statistics: Posted by Iszh — 24 Feb 2016, 13:00