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
)
51 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"')
52 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 # last move has been... - we want to simulate this being _our_ move yet,
60 # i.e. start the simulation with the opponent to play
69 $twogtp_path -black "$black" -white "$white" -auto -verbose -size 9 -komi 7.5 -sgffile "$SEQDIR/r" -games 1 -openings "$SEQDIR"
70 wincolor
=$
(cat "$SEQDIR"/r-0.sgf |
sed -ne 's/.*RE\[\(.\).*/\1/p')
75 echo " *** Result: $wincolor wins => $result"
78 while [ -e stats
]; do
81 W
) nresult
=$
((1-result));
83 echo " + Recording $nresult .. $(pwd) color $color"
85 { read wins
; read sims
; } <stats
86 wins
=$
((${wins%.*}+nresult
))
87 sims
=$
((sims-vloss
+1))
88 { echo $wins; echo $sims; } >stats.new
89 mv stats.new stats
# atomic