164 |
@section The Metamachine |
@section The Metamachine |
165 |
|
|
166 |
An interesting application of the GTP is the concept of |
An interesting application of the GTP is the concept of |
167 |
using GNU Go as an ``Oracle'' which can be consulted by another |
using GNU Go as an ``Oracle'' that can be consulted by another |
168 |
process. This could be another computer program which asks GNU Go |
process. This could be another computer program that asks GNU Go |
169 |
to generate future board positions, then evaluate them. |
to generate future board positions, then evaluate them. |
170 |
|
|
171 |
David Doshay has done interesting experiments with a parallel |
David Doshay at the University of California at Santa Cruz has done |
172 |
engine, known as SlugGo, which is based on GNU Go at the University of |
interesting experiments with a parallel engine, known as SlugGo, that is based |
173 |
California at Santa Cruz. These are described in |
on GNU Go. These are described in |
174 |
@url{http://lists.gnu.org/archive/html/gnugo-devel/2004-08/msg00060.html}. |
@url{http://lists.gnu.org/archive/html/gnugo-devel/2004-08/msg00060.html}. |
175 |
|
|
176 |
A more modest approach using the GTP to communicate with a GNU |
The ``Metamachine'' experiment is a more modest approach using the GTP to |
177 |
Go process which is used as an oracle is the ``Metamachine'' experiment. |
communicate with a GNU Go process that is used as an oracle. The following |
178 |
The following scheme is used. |
scheme is used. |
179 |
|
|
180 |
@itemize @bullet |
@itemize @bullet |
181 |
@item The GNU Go ``oracle'' is asked to generate its top moves using |
@item The GNU Go ``oracle'' is asked to generate its top moves using |
182 |
the gtp @code{top_moves_black} and @code{top_moves} command. |
the GTP @code{top_moves} commands. |
183 |
@item Both moves are tried and @code{estimate_score} is called |
@item Both moves are tried and @code{estimate_score} is called |
184 |
from the resulting board position. |
from the resulting board position. |
185 |
@item The higher scoring position is selected as the engine's move. |
@item The higher scoring position is selected as the engine's move. |
190 |
more elaborate scheme along the same lines could produce |
more elaborate scheme along the same lines could produce |
191 |
a stronger engine. |
a stronger engine. |
192 |
|
|
193 |
Two implementations are distributed. Both make use of @command{fork} and |
Two implementations are distributed with GNU Go. Both make use of |
194 |
@command{pipe} system calls, so they require a Unix-like environment. |
@command{fork} and @command{pipe} system calls, so they require a Unix-like |
195 |
The Metamachine has been tested under GNU/Linux. |
environment. The Metamachine has been tested under GNU/Linux. |
196 |
|
|
197 |
@strong{Note:} If the Metamachine terminates normally, the GNU Go |
@strong{Important:} If the Metamachine terminates normally, the GNU Go |
198 |
process will be killed. However there is a danger that |
process will be killed. However there is a danger that |
199 |
something will go wrong. When you are finished running the |
something will go wrong. When you are finished running the |
200 |
Metamachine, it is a good idea to run @command{ps -A|grep gnugo} |
Metamachine, it is a good idea to run @command{ps -A|grep gnugo} |
209 |
a @code{gnugo} process with which it communicates through the |
a @code{gnugo} process with which it communicates through the |
210 |
GTP, to use as an oracle. |
GTP, to use as an oracle. |
211 |
|
|
212 |
The Metamachine then appears to the client as GTP engine. |
The following scheme is followed: |
|
Thus the following scheme is followed: |
|
213 |
|
|
214 |
@example |
@example |
215 |
stdin pipe a |
stdin pipe a |
216 |
GTP client ----> metamachine -----> GTP engine |
GTP client ----> Metamachine -----> GNU Go |
217 |
<---- <----- |
<---- <----- |
218 |
stdout pipe b |
stdout pipe b |
219 |
@end example |
@end example |
220 |
|
|
221 |
Most commands are passed verbatim to the engine. The exception |
Most commands issued by the client are passed along |
222 |
|
verbatim to GNU Go by the Metamachine. The exception |
223 |
is gg_genmove, which is intercepted then processed differently, |
is gg_genmove, which is intercepted then processed differently, |
224 |
as described above. The top two moves are both tried, the |
as described above. The client is unaware of this, and only |
225 |
position evaluated by estimate_score, and the move yielding the |
knows that it issued a gg_genmove command and received a reply. |
226 |
higher score is selected. |
Thus to the the Metamachine appears as an ordinary GTP engine. |
227 |
|
|
228 |
Usage: no arguments gives normal GTP behavior. |
Usage: no arguments gives normal GTP behavior. |
229 |
@command{metamachine --debug} sends diagnostics to stderr. |
@command{metamachine --debug} sends diagnostics to stderr. |