gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] A speedup


From: Paul Pogonyshev
Subject: Re: [gnugo-devel] A speedup
Date: Tue, 22 Apr 2003 00:06:46 -0400
User-agent: KMail/1.5.9

Portela Fernando wrote:
> A simple idea : do not try the wrong liberty in a ladder attack.
> [...]
> - don't even try the wrong liberty in simple_ladder_attack()
>
> Index: engine/reading.c
> ===================================================================
> RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
> retrieving revision 1.110
> diff -u -r1.110 reading.c
> --- engine/reading.c  1 Mar 2003 12:12:33 -0000       1.110
> +++ engine/reading.c  21 Apr 2003 18:39:50 -0000
> @@ -5491,10 +5491,21 @@
>    /* Get the two liberties of (str). */
>    findlib(str, 2, libs);
>
> -  for (k = 0; k < 2; k++)
> -    ADD_CANDIDATE_MOVE(libs[k], 0, moves, "simple_ladder_attack");
> -
> -  order_moves(str, &moves, other, read_function_name, 0, NO_MOVE);
> +  /* Kludge : If the defender can get enough liberties by playing
> +   * one of these two, then we have no choice but to block there
> +   * and consequently, it is unnecessary to try the other liberty.
> +   */
> +  if (approxlib(libs[0], color, MAXLIBS, NULL) > 3) {
> +    ADD_CANDIDATE_MOVE(libs[0], 0, moves, "simple_ladder_attack");
> +  }
> +  else if (approxlib(libs[1], color, MAXLIBS, NULL) > 3) {
> +    ADD_CANDIDATE_MOVE(libs[1], 0, moves, "simple_ladder_attack");
> +  }
> +  else {
> +    for (k = 0; k < 2; k++)
> +      ADD_CANDIDATE_MOVE(libs[k], 0, moves, "simple_ladder_attack");
> +    order_moves(str, &moves, other, read_function_name, 0, NO_MOVE);
> +  }
>
>    for (k = 0; k < moves.num; k++) {
>      int new_komaster;

can it be a further improvement if we avoid trying any moves at all when
both moves give too much liberties for the defender. i.e. like this:

if (approxlib(libs[0], color, 4, NULL) <= 3)
  ADD_CANDIDATE_MOVE(libs[1], 0, moves, "simple_ladder_attack");
if (approxlib(libs[1], color, 4, NULL) <= 3)
  ADD_CANDIDATE_MOVE(libs[0], 0, moves, "simple_ladder_attack");


Paul






reply via email to

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