Den Fri, 02 Mar 2007 11:44:27 -0800 skrev Paul Rubin: > Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: >> Do you have any ideas how I can sort these moves the fastest? > > One idea: if you're using alpha-beta pruning, maybe you can use > something like heapq instead of sorting, since a lot of the time you > only have to look at the first few moves (ordered best-first).
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? I don't know much of heap queues, but it actually looks very smart. -- http://mail.python.org/mailman/listinfo/python-list