3 # A single iteration of the algorithm
6 # After how many visits (including prior_sims!) a node is expanded.
11 twogtp_path
=/home
/pasky
/gogui-1.3
.2/bin
/gogui-twogtp
23 { read wins
; read sims
; } <stats
25 { echo $wins; echo $xsims; } >stats.new
26 mv stats.new stats
# atomic
28 children
=$
(find .
-maxdepth 1 -type d |
wc -l);
34 if [ -z "$expanded" -a "$sims" -ge "$expand_sims" ]; then
35 echo "(;FF[4]GM[1]CA[UTF-8]RU[Chinese]SZ[9]HA[0]KM[7.5]PW[white]PB[black]$seq)" >"$SEQDIR/a.sgf"
36 "$CMDDIR"/expand.sh
"$pachi"
39 if [ -z "$expanded" ]; then
43 move
=$
("$CMDDIR"/eval.sh
)
45 sgfmove
=$
(echo "$move" | perl
-nle 'my ($x,$y) = /(.)(.)/; $x=lc($x); $x=chr(ord($x)-1) if ord(lc $x) > ord("i"); $y = chr(96+10-$y); print "$x$y"')
46 seq="$seq;${color}[$sgfmove]"
55 echo "*** Sequence: $seq"
56 echo "(;FF[4]GM[1]CA[UTF-8]RU[Chinese]SZ[9]HA[0]KM[7.5]PW[white]PB[black]$seq)" >"$SEQDIR/a.sgf"
59 if [ $
((RANDOM
%2)) = 1 ]; then
66 $twogtp_path -black "$black" -white "$white" -auto -verbose -size 9 -komi 7.5 -sgffile "$SEQDIR/r" -games 1 -openings "$SEQDIR"
67 wincolor
=$
(cat "$SEQDIR"/r-0.sgf |
sed -ne 's/.*RE\[\(.\).*/\1/p')
73 while [ -e stats
]; do
76 W
) nresult
=$
((1-result));
79 { read wins
; read sims
; } <stats
80 wins
=$
((${wins%.*}+nresult
))
81 sims
=$
((sims-vloss
+1))
82 { echo $wins; echo $sims; } >stats.new
83 mv stats.new stats
# atomic