Next: Decide dragon, Previous: Output File, Up: Analyzing
The --decide-string option is used to check the tactical reading code
(see Tactical Reading). This option takes an argument, which is a location
on the board in the usual algebraic notation (e.g.
--decide-string C17). This will tell you whether the reading code (in
engine/reading.c) believes the string can be captured, and if so,
whether it believes it can be defended, which moves it finds to attack or
defend the move, how many nodes it searched in coming to these
conclusions. Note that when GNU Go runs normally (not with
--decide-string) the points of attack and defense are
computed when make_worms()
runs and cached in
worm.attack
and worm.defend
.
If used with an output file (-o filename) --decide-string will produce a variation tree showing all the variations which are considered. This is a useful way of debugging the reading code, and also of educating yourself with the way it works. The variation tree can be displayed graphically using CGoban.
At each node, the comment contains some information. For example you may find a comment:
attack4-B at D12 (variation 6, hash 51180fdf) break_chain D12: 0 defend3 D12: 1 G12 (trivial extension)
This is to be interpreted as follows. The node in question
was generated by the function attack3()
in engine/reading.c,
which was called on the string at D12
. The data in
parentheses tell you the values of count_variations
and
hashdata.hashval
.
The second value (“hash”) you probably will not need to know
unless you are debugging the hash code, and we will not discuss it.
But the first value (“variation”) is useful when using the debugger
gdb. You can first make an output file using
the -o option, then walk through the reading with
gdb, and to coordinate the SGF file with the debugger,
display the value of count_variations
. Specifically,
from the debugger you can find out where you are as follows:
(gdb) set dump_stack() B:D13 W:E12 B:E13 W:F12 B:F11 (variation 6)
If you place yourself right after the call to trymove()
which generated the move in question, then the variation number
in the SGF file should match the variation number displayed by
dump_stack()
, and the move in question will be the
last move played (F11 in this example).
This displays the sequence of moves leading up to the variation
in question, and it also prints count_variations-1
.
The second two lines tell you that from this node, the function
break_chain()
was called at D12 and returned 0 meaning
that no way was found of rescuing the string by attacking
an element of the surrounding chain, and the function
defend3()
was called also at D12 and returned 1,
meaning that the string can be defended, and that
G12 is the move that defends it. If you have trouble
finding the function calls which generate these comments,
try setting sgf_dumptree=1
and setting a breakpoint in
sgf_trace
.