Sort with extra variables
Sat Mar 3 01:46:05 CET 2007
Thomas Dybdahl Ahle <lobais at gmail.com> writes:
> Do you mean that I add my moves something like this?
> from heapq import heappush, heappop
> heap = 
> for move in genAll():
> heappush(heap, (-getMoveValue (board, table, ply, move), move))
> And then use heappop(heap) in the alphabeta loop?
Yes, something like that. If you want to get, say, the five smallest
values in a list, heapq lets you do that without having to sort the
More information about the Python-list