Rogue9 fed this fish to the penguins on Thursday 17 July 2003 08:05 am:
Ignoring all the pickle stuff...
Question, does the skip list go back to 0 /on/ the draw that the ball
was picked (meaning that the skip list is counting how many draws it
was NOT picked -- and would imply that you would ALWAYS see a 0).
draw = 1
while 1:
if draw == 300:# limited to 300 whilst debugging
break
x = masterList[draw-1]
print draw,x
Okay, you've just pull a sublist of the form
[1,'1994-10-19',3,14,16,23,34,43,2,3,'ARTHUR',234]
# Now we must write the skip frequency data into the table
b1 = x[2]
b1 = 3, if I use your sample sublist...
b2 = x[3]
b3 = x[4]
b4 = x[5]
b5 = x[6]
b6 = x[7]
What is all that supposed to represent? b1-b6 are taking on the value
of the /ball/ that shows up in that position. Why bother, you can put
x[?] at each use of b? below.
print b1,b2,b3,b4,b5,b6
r1 = skipFreqList[b1-1]
r1 = ['Ball3',....]
r2 = skipFreqList[b2-1]
r3 = skipFreqList[b3-1]
r4 = skipFreqList[b4-1]
r5 = skipFreqList[b5-1]
r6 = skipFreqList[b6-1]
Okay, the r1..r6 should now be the skip LIST for whatever ball# is in
the b1..b6.
But where do you index /into/ those lists for the specific skip value.
IE,
s1 = r1[draw]
print r1,r2,r3,r4,r5,r6
skip1 = r1[draw]
print skip1
draw = draw+1
return
if __name__ == '__main__':
unittest.main()
# watch out for line wrapping in the news client!
masterList = [
[1, '1994-10-19', 3, 14, 16, 23, 34, 43, 2, 3, 'Arthur', 234],
[2, '1994-10-28', 10, 14, 23, 25, 30, 49, 3, 4, 'What are those
last', 8378],
[3, '1994-11-10', 3, 15, 23, 24, 29, 40, 4, 5, 'Huh?', 838] ]
skipFreqList = [ #How do you initialize a skip for a never
drawn
['Ball1', -1, -1, -1], #first time
['Ball2', -1, -1, -1],
['Ball3', 0, 1, 0],
['Ball4', -1, -1, -1],
['Ball5', -1, -1, -1],
['Ball6', -1, -1, -1],
['Ball7', -1, -1, -1],
['Ball8', -1, -1, -1],
['Ball9', -1, -1, -1],
['Ball10', -1, 0, 1],
['Ball11', -1, -1, -1],
['Ball12', -1, -1, -1],
['Ball13', -1, -1, -1],
['Ball14', 0, 0, 1],
['Ball15', -1, -1, 0],
['Ball16', 0, 1, 2],
['Ball17', -1, -1, -1],
['Ball18', -1, -1, -1],
['Ball19', -1, -1, -1],
['Ball20', -1, -1, -1],
['Ball21', -1, -1, -1],
['Ball22', -1, -1, -1],
['Ball23', 0, 0, 0],
['Ball24', -1, -1, 0],
['Ball25', -1, 0, 1],
['Ball26', -1, -1, -1],
['Ball27', -1, -1, -1],
['Ball28', -1, -1, -1],
['Ball29', -1, -1, 0],
['Ball30', -1, 0, 1],
['Ball31', -1, -1, -1],
['Ball32', -1, -1, -1],
['Ball33', -1, -1, -1],
['Ball34', 0, 1, 2],
['Ball35', -1, -1, -1],
['Ball36', -1, -1, -1],
['Ball37', -1, -1, -1],
['Ball38', -1, -1, -1],
['Ball39', -1, -1, -1],
['Ball40', -1, -1, 0],
['Ball41', -1, -1, -1],
['Ball42', -1, -1, -1],
['Ball43', 0, 1, 2],
['Ball44', -1, -1, -1],
['Ball45', -1, -1, -1],
['Ball46', -1, -1, -1],
['Ball47', -1, -1, -1],
['Ball48', -1, -1, -1],
['Ball49', -1, 0, 1] ]
print "skip values of '-1' signify this is the first time"
print "that this ball has been drawn"
print ""
for bnum in masterList[0][2:8]:
print "%8s" % bnum,
print " ball"
for x in range(2, 8):
print "%8s" % -1,
print " skips"
print ""
for i in xrange(1,len(masterList)): #skip first draw, there are no
skips
draw = masterList
for bnum in draw[2:8]:
print "%8s" % bnum,
print " ball"
for bnum in draw[2:8]:
print "%8s" % skipFreqList[bnum-1],
print " skips"
print ""
--