gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] engine/sgffile.c


From: Gunnar Farneback
Subject: Re: [gnugo-devel] engine/sgffile.c
Date: Sat, 31 Aug 2002 00:23:59 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Paul wrote:
> do we need code in engine/sgffile.c which outputs to a file provided
> with -o option? there's a better approach in sgf/sgf* files.

Most of the code in engine/sgffile.c only remains for historic
reasons. I plan to migrate all sgf code to use the SGFNode and SGFTree
structures. Currently the sgf output code is rather messy in many
places.

E.g. in gmp mode, the game is both recorded continously to file with
sgffile code and stored in memory in an SGFTree structure. At the end
of the game the SGFTree is just discarded.

The only reason why the sgffile code has survived so long is because
it writes moves continously to file and thus leaves some traces when
the program crashes. It's however perfectly possible to do this also
with the SGFTree approach. The trick is simply to dump the entire tree
to file (i.e. rewriting it) each time a move is made, which really
isn't very expensive. As an extra plus this means that we have valid
sgf files available at all times and don't have to patch in a final
')' for a game record from a crash.

/Gunnar




reply via email to

[Prev in Thread] Current Thread [Next in Thread]