[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] make komaster variables global?
From: |
Arend Bayer |
Subject: |
[gnugo-devel] make komaster variables global? |
Date: |
Tue, 25 Jun 2002 17:07:07 +0200 (CEST) |
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).
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.
This would mean that the reading functions would not need to bother
about the komaster at all. If a function wants to care, we can still
provide s.th. like a pair
set_komaster_state(new_komaster, new_kom_pos, &save_komaster, &save_kom_pos)
restore_komaster(save_komaster, save_kom_pos)
I think this would make reading.c considerable more readable.
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)...)
Disabling all ko captures for owl helper functions could then be handled
by a new komaster state DISABLE_KO. (I.e., insert a pair
set_komaster_state(DIABLE_KO, 0, &save...)
...
restore_komaster
in owl_check_pattern_hard.
Opinions?
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?
Arend
- [gnugo-devel] make komaster variables global?,
Arend Bayer <=