gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] a patch from a newbie :)


From: Gunnar Farneback
Subject: Re: [gnugo-devel] a patch from a newbie :)
Date: Tue, 10 Sep 2002 18:34:47 +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)

Portela wrote:
> I would like to submit a patch for revision/discussion. I tried to
> solve the problem in blunder.tst:12 and after a long thought (+
> reading and tracing the source code), I came up with the attached
> patch. I have been very conservative, since I didn't allow for any
> breakage in the regressions, but I think that this patch has a good
> margin for improvements. But before working any further on it and
> since it involves some important changes (see gnugo.h), I would like
> it to be first reviewed and discussed here.

The new result codes certainly require discussion. In the mean time we
would, as Arend has commented, be happy to get a partial patch doing
the following:

* Change 1, 2, 3 to KO_B, KO_A, WIN wherever those macros are
  appropriate.
* Change any occurences of the form "3 - code" or "WIN - code" to
  "REVERSE_RESULT(code)".

> --- gnugo-3.3.8/interface/play_gtp.c  2002-09-03 16:13:38.000000000 +0200
> +++ gnugo-3.3.8-patch/interface/play_gtp.c    2002-09-10
> 03:46:17.000000000 +0200
> @@ -2923,7 +2923,7 @@
>  static void
>  gtp_print_code(int c)
>  {
> -  gtp_printf("%d", c ? 4-c : c);
> +  gtp_printf("%d", c ? (WIN+1)-c : c);
>  }
>  
>  static void
> diff -u -r gnugo-3.3.8/regression/connection.tst
> gnugo-3.3.8-patch/regression/connection.tst
> --- gnugo-3.3.8/regression/connection.tst     2002-08-13
> 19:59:14.000000000 +0200
> +++ gnugo-3.3.8-patch/regression/connection.tst       2002-09-10
> 04:00:47.000000000 +0200
> @@ -302,7 +302,7 @@
>  # See also nngs2:130
>  loadsgf games/nngs/joshj-gnugo-3.3.2-200205310709.sgf 124
>  93 disconnect K2 L3
> -#? [3 L2]*
> +#? [5 L2]*

The reason why we have a magic gtp_print_code() function is that the
result codes in the GTP output for historic reasons are
0 - failure (0)
1 - WIN
2 - KO_A
3 - KO_B

If we add 2 new result codes we would want to call them 4 and 5
regardless of their relative value or internal representation. So
instead of changing a lot of codes in the regression files you should
add some complexity to the gtp_print_code() function.

/Gunnar




reply via email to

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