I finished reading the code for the routine "count" in the C source for
the Go playing program Wally. I downloaded it a long time ago but it
should
be at
http://www.usgo.org/resources/computer.html
I know there are better programs but I'm just doing this for practice and
this
is a fairly small program to study. The routine takes as inputs the
integer
coordinates of a position on the board and also some parameters, one of
which
is a board (i.e. double array of int of a certain size), called "scratch",
which is used to keep track of which positions have been looked at. After
modifying the entry of scratch for the position (x,y), it then examines
the
(up to) 4 adjacent positions and, in each case, if certain conditions are
met,
it runs through the code for that position. Let me be more precise about
that:
for the first 3 of the 4 possible adjacent positions, it runs through the
code
by calling "count" with the same parameters except at this adjacent
position,
but for the 4th it jumps to a label at the beginning of the code for
"count".
So, in all 4 cases, it seems that the behavior is essentially the same.
What I'd like to know is whether there is any reason why it might be
advantageous to use a goto in the 4th case but a self-call in the other
three cases? Would it be better to use the goto in all 4 cases, e.g. due
to some overhead from the function call?
--
Ignorantly,
Allan Adler <ara@[EMAIL PROTECTED]
>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions
and
* comments do not reflect in any way on MIT. Also, I am nowhere near
Boston.
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|