[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] sgf/sgfnode.c possible error
From: |
Paul Pogonyshev |
Subject: |
Re: [gnugo-devel] sgf/sgfnode.c possible error |
Date: |
Wed, 15 Sep 2004 11:54:05 -0200 |
User-agent: |
KMail/1.4.3 |
Dmitri Koulikov wrote:
> I've found a controversial usage of 'parent' link of SGFNode in
> functions sgfPrev and sgfAddChild by one side and sgfStartVariant and
> sgfStartVariantFirst by the other. The first ones use it always as a
> pointer to the parent node while the latter use it to show to the
> previous sibling if it exist and to the parent if not.
> Where is the truth?
I cannot understand what you mean. The structure of an SGF tree
inside GNU Go looks like this:
parent node
|
(first) child --> next (child) --> next (child) --> NULL
So, the childs form a single-linked list. Since you cannot go
directly backwards in a single-linked list, you need to start
from the list beginning and skip forward. In other words,
previous node can be found like this:
if (node->parent) {
previous = node->parent->child;
while (previous->next != node)
previous = previous->next;
}
Paul
- [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/14
- Re: [gnugo-devel] sgf/sgfnode.c possible error,
Paul Pogonyshev <=
- Re: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Message not available
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Re[4]: [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/16
- Re: Re[4]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/16
- Re[6]: [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/17
- Re: Re[6]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/17
- [gnugo-devel] sgf/sgfnode.c more inproverment, Dmitri Koulikov, 2004/09/19
- Re: [gnugo-devel] sgf/sgfnode.c more inproverment, Paul Pogonyshev, 2004/09/19
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Arend Bayer, 2004/09/22