1 #!/usr/bin/env python2.5
6 This file is part of Arrocco, which is Copyright 2007 Thomas Plick
7 (tomplick 'at' gmail.com).
9 Arrocco is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 Arrocco is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 import getopt
, sys
, cpu
24 from position
import *
35 options
, args
= getopt
.getopt(sys
.argv
[1:], "a24", ["cpus="])
36 options
= dict(options
)
38 fen
= (args
+ [ipos
.fen()])[0]
41 measuredCpus
= cpu
.count_cpus()
44 if '-a' in options
: cpus
= measuredCpus
45 elif '-2' in options
: cpus
= 2
46 elif '-4' in options
: cpus
= 4
49 cpus
= int(options
['--cpus'])
54 print "Using %s CPUs." % (2**splits
)
55 if measuredCpus
> cpus
:
56 print " (Note: You specified %s CPU%s, but your system appears to have %s." % \
57 (cpus
, '' if cpus
== 1 else 's', measuredCpus
)
58 print " If you would like to use them, specify `--cpus=%s' on the command line.)" % \
63 for d
in range(3, 100):
64 x
= alphaBeta(pos
, d
, top
= True, splits
= splits
)
65 print "\nDepth %d:" % d
66 print " ", removePV(x
)
67 print " ", algebraicForPV(x
['pv'])
69 if __name__
== '__main__':
70 thread
.start_new_thread(mainidea
, ())