Make the population explicitly ordered.
This commit is contained in:
parent
e8abbbd16e
commit
bbe4ac960f
20
words.py
20
words.py
|
@ -46,19 +46,18 @@ while True:
|
|||
for w, r, p in r.fetchall()
|
||||
}
|
||||
|
||||
pop = [(
|
||||
(x,y),
|
||||
xs.productivity*ys.productivity,
|
||||
) for x, xs in scores.items()
|
||||
for y, ys in scores.items()
|
||||
]
|
||||
|
||||
while True:
|
||||
(x, y), = random.sample(
|
||||
k=1,
|
||||
population=[
|
||||
(x,y)
|
||||
for x in scores.keys()
|
||||
for y in scores.keys()
|
||||
],
|
||||
counts=[
|
||||
xs.productivity*ys.productivity
|
||||
for xs in scores.values()
|
||||
for ys in scores.values()
|
||||
],
|
||||
population=[xy for xy,_ in pop],
|
||||
counts=[score for _,score in pop],
|
||||
)
|
||||
|
||||
r = db.execute('''
|
||||
|
@ -70,6 +69,7 @@ while True:
|
|||
''', (x, y))
|
||||
if r.fetchall()[0][0]:
|
||||
# we already know the answer
|
||||
log.info('already got %s + %s', x, y)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue