7 fen
= (sys
.argv
+ ["-"])[1]
10 def strangeKey((x
, y
)):
11 if x
== 'pv': return ('zzzzzzz', y
)
16 if fen
== '-': pos
= ipos
17 else: pos
= position(fen
)
20 for depth
in range(0, 1000):
23 result
= alphaBetaWithOldPV(pos
, depth
, oldVariation
= result
['pv'])
25 for (k
, v
) in sorted(result
.items(), key
= strangeKey
):
27 if k
== 'value' and pos
.turn
== 1:
29 print "%s: %s" % (k
, v
)
30 print "Variation: %s" % algebraicForPV(result
['pv'])
31 print "Took %s seconds" % (int(b
-a
)+1)
38 def alphaBetaWithOldPV2(pos
, depth
, oldVariation
):
39 arr
= (Position
* len(oldVariation
))()
41 children
= (Position
* (depth
* 512))()
44 value
= lib
.alphaBetaWithOldPV(ctypes
.byref(pos
), children
,
45 depth
, -99999, 99999, ctypes
.byref(counter
), arr
, len(oldVariation
))
49 for i
in range(depth
+ 1):
52 node
= node
.children()[self
.branch
[i
]]
56 return dict(depth
= depth
, value
= value
, pv
= L
, nodeCount
= counter
.value
)
59 if __name__
== '__main__':
60 thread
.start_new_thread(f
, ())