[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] auto generated regression tests
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] auto generated regression tests |
Date: |
Sun, 04 Aug 2002 22:58:16 +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) |
Dan wrote:
> As a general comment, the dragon_status is not a very important
> field.
The status field of the dragon_data struct is not very accurate no,
but that is not what the gtp dragon_status function reports. The
purpose of the function is to return the engine's best estimate of a
dragon's status, whatever internal data structures are involved. The
function looks like this:
| /* Function: Determine status of a dragon.
| * Arguments: vertex
| * Fails: invalid vertex, empty vertex
| * Returns: status ("alive", "critical", "dead", or "unknown"),
| * attack point, defense point. Points of attack and
| * defense are only given if the status is critical and the
| * owl code is enabled.
| *
| * FIXME: Should be able to distinguish between life in seki
| * and life with territory. Should also be able to identify ko.
| */
|
| static int
| gtp_dragon_status(char *s, int id)
| {
| int i, j;
|
| if (!gtp_decode_coord(s, &i, &j))
| return gtp_failure(id, "invalid coordinate");
|
| if (BOARD(i, j) == EMPTY)
| return gtp_failure(id, "vertex must not be empty");
|
| silent_examine_position(BLACK, EXAMINE_DRAGONS);
|
| /* FIXME: We should also call the semeai module. */
|
| if (dragon[POS(i, j)].owl_status == UNCHECKED) {
| if (dragon[POS(i, j)].status == ALIVE)
| return gtp_success(id, "alive");
|
| if (dragon[POS(i, j)].status == DEAD)
| return gtp_success(id, "dead");
|
| if (dragon[POS(i, j)].status == UNKNOWN)
| return gtp_success(id, "unknown");
|
| assert(dragon[POS(i, j)].status == CRITICAL); /* Only remaining
possibility. */
| return gtp_success(id, "critical");
| }
|
| /* Owl code active. */
| if (dragon[POS(i, j)].owl_status == ALIVE)
| return gtp_success(id, "alive");
|
| if (dragon[POS(i, j)].owl_status == DEAD)
| return gtp_success(id, "dead");
|
| if (dragon[POS(i, j)].owl_status == UNKNOWN)
| return gtp_success(id, "unknown");
|
| assert(dragon[POS(i, j)].owl_status == CRITICAL);
| /* Status critical, need to return attack and defense point as well. */
| gtp_printid(id, GTP_SUCCESS);
| gtp_printf("critical ");
| gtp_print_vertex(I(dragon[POS(i, j)].owl_attack_point),
| J(dragon[POS(i, j)].owl_attack_point));
| gtp_printf(" ");
| gtp_print_vertex(I(dragon[POS(i, j)].owl_defense_point),
| J(dragon[POS(i, j)].owl_defense_point));
| return gtp_finish_response();
| }
This should probably be rewritten today using the matcher_status field
of the dragon_data struct. (The function predates the matcher_status
field and, as can be deduced from a comment, was written while the owl
code was still an experimental option.)
> Probably these tests should be in terms of either matcher_status or
> owl tests.
No, dragon_status is perfectly fine. Owl tests are of course fine as
well, but only really needed when ko results are involved. See
ld_owl.tst for lots of examples.
/Gunnar
- [gnugo-devel] auto generated regression tests, Evan Berggren Daniel, 2002/08/03
- Re: [gnugo-devel] auto generated regression tests,
Gunnar Farneback <=
- Re: [gnugo-devel] auto generated regression tests, bump, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, Gunnar Farneback, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, bump, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, bump, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, bump, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, Gunnar Farneback, 2002/08/05
- Re: [gnugo-devel] auto generated regression tests, bump, 2002/08/06
- Re: [gnugo-devel] auto generated regression tests, Gunnar Farneback, 2002/08/07
- Re: [gnugo-devel] auto generated regression tests, Gunnar Farneback, 2002/08/07
- Re: [gnugo-devel] auto generated regression tests, Gunnar Farneback, 2002/08/05