gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] another semeai patch


From: sp lee
Subject: Re: [gnugo-devel] another semeai patch
Date: Wed, 14 Jan 2004 22:05:24 -0800


> On Wed, 14 Jan 2004, SP Lee wrote:
>
> > Index: owl.c
> > ===================================================================
> > RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
> > retrieving revision 1.187
> > diff -u -r1.187 owl.c
> > --- owl.c       7 Jan 2004 10:00:20 -0000       1.187
> > +++ owl.c       14 Jan 2004 22:15:10 -0000
> > @@ -1255,6 +1255,9 @@
> >    int k;
> >
> >    for (k = 0; k < MAX_MOVES-1; k++) {
> > +  /* Eating lunch decreases own liberties during semeai */
> > +    if (owl_moves[k].name == "eat lunch")
> > +      continue;
>
> This looks wrong.  You can't compare a string in this way.  Either you
> should use strcmp() or (preferrably) use another way entirely to catch
> this move.
>
> >      move = owl_moves[k].pos;
> >      if (move == NO_MOVE)
> >        break;
> >
>
> -Inge
>

I'm using cygwin and it compiles and runs ok. However, when I changed it
into strcmp like
if (strcmp(owl_moves[k].name, "eat lunch") == 0 && ......
I got a run time error although it compiled ok. So at this moment I don't
have other solution. Any suggestion to avoid string comparison is welcome.

I do have added a constraints to this patch to eliminate the unexpected
fails. After this new patch there is only one pass at semeai:58 and no other
breakage.

SP Lee

$ cvs diff -u owl.c
Index: owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.187
diff -u -r1.187 owl.c
--- owl.c       7 Jan 2004 10:00:20 -0000       1.187
+++ owl.c       15 Jan 2004 06:01:01 -0000
@@ -1255,6 +1255,11 @@
   int k;

   for (k = 0; k < MAX_MOVES-1; k++) {
+    /* Eating lunch is only allowed when probable_eye > 1, otherwise it
+     * is considered as reducing own liberties
+     */
+    if (owl_moves[k].name == "eat lunch" && owl_moves[k].value < 76)
+      continue;
     move = owl_moves[k].pos;
     if (move == NO_MOVE)
       break;







reply via email to

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