[Top][All Lists]

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

Re: [gnugo-devel] make komaster variables global?

From: Gunnar Farneback
Subject: Re: [gnugo-devel] make komaster variables global?
Date: Tue, 25 Jun 2002 22:12:39 +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)

Arend wrote:
> I think it would make sense to make komaster and kom_pos static privat
> variables in board.c (or just global variables, no big difference
> here).

Static is usually better, unless they need to be accessible elsewhere.

> They would then be accessed only by komaster_trymove; if they change,
> they can be stored on the stack with the PUSH_VALUE construct, so that
> they get automatically restored in undo_trymove() (called from popgo() )
> -- I think this PUSH_VALUE / POP_MOVE construct is quite elegant.

It is indeed. Credits go to Tanguy who introduced this idea.

> A side effect, if e.g. the connection reading already depends on a ko, say
> O is komaster, then the default would be that any attack() etc. that
> is called as a helper function in the reading code would already start
> with O being komaster. I think this side effect should be desirable
> (and if not, we can still provide clear_komaster(&save_komaster)...)

I agree that it's probably desirable.

> Opinions?

I think it would work, although I'm not completely certain there
aren't any complications. One thing to consider is whether a
non-komaster trymove() should reset the komaster variables.

> The only thing that makes me hesitate a little before starting to write
> a patch to do this is that 5 komaster_trymove routines would have to be
> changed. Are there some komaster schemes that are clearly redundant and
> could get removed?

In my opinion scheme 5 is superior, but I don't think there have been
any serious attempts to evaluate them accurately. Scheme 4 was
introduced by Trevor in an attempt to solve certain problems with the
pattern based tactical reading and those may or may not be addressed
by scheme 5.


reply via email to

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