| www.delorie.com/gnu/docs/gnugo/gnugo_183.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The reading code searches for a path through the move tree to determine whether a string can be captured. We have a tool for investigating this with the `--decidestring' option. This may be run with or without an output file.
Simply running
|
will run attack() to determine whether the string can be captured.
If it can, it will also run find_defense() to determine whether or
not it can be defended. It will give a count of the number of
variations read. The `-t' is necessary, or else GNU Go will not
report its findings.
If we add `-o output file' GNU Go will produce an output file with all variations considered. The variations are numbered in comments.
This file of variations is not very useful without a way of navigating the source code. This is provided with the GDB source file, listed at the end. You can source this from GDB, or just make it your GDB init file.
If you are using GDB to debug GNU Go you may find it less
confusing to compile without optimization. The optimization
sometimes changes the order in which program steps are
executed. For example, to compile `reading.c' without optimization,
edit `engine/Makefile' to remove the string -O2 from
the file, touch `engine/reading.c' and make. Note that the
Makefile is automatically generated and may get overwritten
later.
If in the course of reading you need to analyze a result where a function gets its value by returning a cached position from the hashing code, rerun the example with the hashing turned off by the command line option `--hash 0'. You should get the same result. (If you do not, please send us a bug report.) Don't run `--hash 0' unless you have a good reason to, since it increases the number of variations.
With the source file given at the end of this document loaded, we can now navigate the variations. It is a good idea to use cgoban with a small `-fontHeight', so that the variation window takes in a big picture. (You can resize the board.)
Suppose after perusing this file, we find that variation 17 is interesting and we would like to find out exactly what is going on here.
The macro 'jt n' will jump to the n-th variation.
(gdb) set args -l [filename] -L [move number] --decidestring [location] (gdb) tbreak main (gdb) run (gdb) jt 17 |
will then jump to the location in question.
Actually the attack variations and defense variations are numbered
separately. (But find_defense() is only run if attack() succeeds,
so the defense variations may or may not exist.) It is redundant to
have to tbreak main each time. So there are two macros avar and dvar.
(gdb) avar 17 |
restarts the program, and jumps to the 17-th attack variation.
(gdb) dvar 17 |
jumps to the 17-th defense variation. Both variation sets are found in the same sgf file, though they are numbered separately.
Other commands defined in this file:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |