gnugo-devel
[Top][All Lists]
Advanced

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

arend_3_4.2a: (Re: [gnugo-devel] arend_3_4.3: don't crash on invalid sgf


From: Arend Bayer
Subject: arend_3_4.2a: (Re: [gnugo-devel] arend_3_4.3: don't crash on invalid sgf-move)
Date: Sat, 15 Jun 2002 20:53:19 +0200 (CEST)

On Sat, 15 Jun 2002 address@hidden wrote:

>
> >  - Don't crash due to invalid move in .sgf-file.
> >

> This patch (under the name arend_3_4.2) was briefly in the CVS
> but I backed it out after discovering that it causes problems
> with the regressions. I'm not sure whether there are actually
> bogus sgf files or whether the patch is broke or both.

That was caused by the patch being broken. I somehow had assumed that
pass moves are treated earlier on already and didn't check for them.
Hmph.

I have now tested the patch by loading all .sgf-files in the regression
directory...and it turned out there are indeed some broken .sgf-files.
Two are fixed in the patch.

Completely broken are the files
./games/pending/nightmare.sgf (empty file)
./golois/Handtalk980828-1.sgf
./golois/adherence.sgf
./golois/eb000103.sgf (all three contain no moves but a bogus header)
and should be removed.

While we are there,
games/mertin13x13/gnugo-gointellect3.W+37.move_83.sgf
also has no point being in CVS, it's a debug file that somehow slipped in
the tar-ball when I submitted the 13x13 test suite.

Arend

 - Fix a few .sgf-files.
 - Don't crash due to invalid move in .sgf-file.

(and don't complain about PASS either...)

Index: engine/interface.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/interface.c,v
retrieving revision 1.19
diff -u -r1.19 interface.c
--- engine/interface.c  3 Jun 2002 15:00:59 -0000       1.19
+++ engine/interface.c  15 Jun 2002 18:51:38 -0000
@@ -605,10 +605,18 @@
          }

        rotate(i, j, &i, &j, board_size, orientation);
-       gnugo_play_move(i, j, next);
-       sgffile_move_made(i, j, next, 0);
-       next = OTHER_COLOR(next);
-
+       if ((ON_BOARD2(i,j) && board[POS(i, j)] == EMPTY)
+           || (i == -1 && j == -1)) {
+         gnugo_play_move(i, j, next);
+         sgffile_move_made(i, j, next, 0);
+         next = OTHER_COLOR(next);
+       }
+       else {
+         gprintf("WARNING: Move off board or on occupied position found in 
sgf-file.\n");
+         gprintf("Move at %m ignored, trying to proceed.\n", i, j);
+         return next;
+       }
+
        break;

       case SGFIL:
Index: regression/games/ko6.sgf
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/games/ko6.sgf,v
retrieving revision 1.1
diff -u -r1.1 ko6.sgf
--- regression/games/ko6.sgf    27 Feb 2002 22:14:56 -0000      1.1
+++ regression/games/ko6.sgf    15 Jun 2002 18:51:40 -0000
@@ -5,6 +5,5 @@
 SZ[9]
 AP[Jago:Version 4.18]
 AB[cf][df][de][dd][cd][dc][ed][fd][fc][fe][ff][gf][gd][ef][dg][fg][ee][he][be]
-AW[dh][di][ei][fi][fh][gh][gg][hg][hf][ie][if][id][hd][hc][gc][gb][fb][fa][ea][d
-a][db][cb][cc][bc][bd][ad][ae][af][bf][bg][cg][ch][eg][ec]
+AW[dh][di][ei][fi][fh][gh][gg][hg][hf][ie][if][id][hd][hc][gc][gb][fb][fa][ea][da][db][cb][cc][bc][bd][ad][ae][af][bf][bg][cg][ch][eg][ec]
 )
Index: regression/games/trevor/auto/b99.sgf
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/games/trevor/auto/b99.sgf,v
retrieving revision 1.2
diff -u -r1.2 b99.sgf
--- regression/games/trevor/auto/b99.sgf        16 Dec 2001 02:10:58 -0000      
1.2
+++ regression/games/trevor/auto/b99.sgf        15 Jun 2002 18:51:45 -0000
@@ -3,6 +3,6 @@
 ;B[hd];W[fi];B[dh];W[jb];B[ib];W[kb];B[fg];W[hh];B[hg];W[bj];B[hb];W[ai];B[cj]
 ;W[bh];B[df];W[bf];B[gh];W[ci];B[gi];W[fj];B[eh];W[cf];B[bd];W[ce];B[de];W[ei]
 ;B[di];W[ih];B[ig];W[ji];B[lh];W[ek];B[lg];W[lj];B[mf];W[md];B[li];W[hi];B[ch]
-;W[cg];B[cd];W[gj];B[be];W[fh];B[gg];W[dg];B[eg];W[bi];B[af]C[B7];W[ag];B[bg];B[bg]
+;W[cg];B[cd];W[gj];B[be];W[fh];B[gg];W[dg];B[eg];W[bi];B[af]C[B7];W[ag];B[bg]
 ;W[mi];B[ja];W[ka];B[ia];W[mh];B[ah];W[bk];B[ag];W[jg];B[kh];W[me];B[jf];W[mg]
 ;B[kg];W[tt];B[tt])





reply via email to

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