Article View: gnu.chess
Article #5291Re: Need help on using gnuan for own games.
From: Tim Mann
Date: Fri, 10 Dec 1993 01:19
Date: Fri, 10 Dec 1993 01:19
201 lines
7108 bytes
7108 bytes
gnuan actually has code to parse the xboard output format, but until
very recently it was broken. (Some time ago I changed the xboard
output format to use short algebraic instead of coordinate notation,
not realizing gnuan had a feature to read the old format.) I
submitted a patch to gnuan, but if I remember correctly, it won't be
released until patchlevel 63 of gnuchess. Also, even with the patch,
the feature that counts how many moves agreed with gnu's prediction
remains broken, because it works on the character-string move notation
instead of the internal representation of the move. Maybe Mike will
fix that before release if he has time.
--Tim
p.s. Here is the patch:
Return-Path: mann
Received: by src-mail.pa.dec.com; id AA21539; Tue, 24 Aug 93 13:36:39 -0700
Received: by cypress.pa.dec.com; id AA04441; Tue, 24 Aug 93 13:36:37 -0700
Message-Id: <9308242036.AA04441@cypress.pa.dec.com>
To: bug-gnu-chess@prep.ai.mit.edu
Cc: mann
Subject: gnuan bug reading xboard save files
Date: Tue, 24 Aug 93 13:36:36 -0700
From: mann
X-Mts: smtp
I didn't know gnuan could read xboard save files at all until an
xboard user told me the feature had stopped working.
The feature first broke when I added a "#" to the first line of the
save file format, and broke more seriously when I changed the format
to use abbreviated algebraic instead of coordinate algebraic. gnuan
doesn't like the "x" for capture or the 0-0 for castling in that
format.
Below is a quick and dirty patch to fix these problems. However,
there are some other gnuan problems I noticed that I haven't fixed.
I'll list them after the patch.
-----cut here-----
*** gnuan.c.~1~ Tue Jun 22 06:49:33 1993
--- gnuan.c Tue Aug 24 13:02:39 1993
***************
*** 220,230 ****
--- 220,232 ----
{
strcpy (mvstr[1], "o-o");
strcpy (mvstr[2], "O-O");
+ strcpy (mvstr[3], "0-0");
}
else
{
strcpy (mvstr[1], "o-o-o");
strcpy (mvstr[2], "O-O-O");
+ strcpy (mvstr[3], "0-0-0");
}
}
}
***************
*** 235,240 ****
--- 237,267 ----
int
+ strxcmp(char *sx, char *sbase)
+ /*
+ * Compare strings sx and sbase, but ignore any 'x' characters
+ * found in sx. This kludge lets gnuan parse notation with "x"
+ * for capture.
+ */
+ {
+ for (;;) {
+ if (*sx == 'x') sx++;
+ if (*sx == '\0') {
+ if (*sbase == '\0')
+ return 0;
+ else
+ return -1;
+ }
+ if (*sx < *sbase)
+ return -1;
+ else if (*sx > *sbase)
+ return 1;
+ sx++;
+ sbase++;
+ }
+ }
+
+ int
VerifyMove (char *s, short int iop, unsigned short int *mv)
/*
***************
*** 260,267 ****
{
node = &Tree[pnt++];
algbr (node->f, node->t, (short) node->flags);
! if (strcmp (s, mvstr[0]) == 0 || strcmp (s, mvstr[1]) == 0 ||
! strcmp (s, mvstr[2]) == 0 || strcmp (s, mvstr[3]) == 0)
{
cnt++;
xnode = *node;
--- 287,294 ----
{
node = &Tree[pnt++];
algbr (node->f, node->t, (short) node->flags);
! if (strxcmp (s, mvstr[0]) == 0 || strxcmp (s, mvstr[1]) == 0 ||
! strxcmp (s, mvstr[2]) == 0 || strxcmp (s, mvstr[3]) == 0)
{
cnt++;
xnode = *node;
***************
*** 997,1003 ****
/* lets find out about this file */
fgets (InBuf, 256, fpin);
InFileType = OTHER;
! if (!strncmp (InBuf, "xboard", 6))
{
InFileType = XBOARD;
fgets (InBuf, 256, fpin);
--- 1024,1030 ----
/* lets find out about this file */
fgets (InBuf, 256, fpin);
InFileType = OTHER;
! if (!strncmp (InBuf, "xboard", 6) || !strncmp (InBuf, "# xboard", 8))
{
InFileType = XBOARD;
fgets (InBuf, 256, fpin);
-----cut here-----
Other problems:
1) gnuan checks whether the actual move matches the suggested move by
doing a string comparison. This gets the wrong answer if the actual
move was the same but in different notation---for example, Nf3 vs.
g1f3.
2) Sometimes it seems that gnuan doesn't think about what move to make
next when it should. Here is some output I got, where it didn't think
about white's move 5, black's move 5, or white's move 6:
-----cut here-----
gnuan
Book used 9585 of 12000 entries.
Playing without hashfile
Input the file with the algebraic moves of the game.
/udir/mann/chess/games/mann-AntiGod.game
Input the search depth you want to use. (1 to 29)(- for depth from file)
4
Input the maximum number of minutes per move you want to use.
1
You will search to 4 half moves
With no search taking more than 1 minutes
Move White Black Score Depth Best Line
------------------------------------------------------------------
1 e4 - - book
e6 - - book
2 d4 - - book
d5 - - book
3 Nd2 - - book
c5 - - book
Move# 4 Target= 6000 Clock: -14
2. 28 0 1887 g1f3 c5d4 f3d4
3& 18 1 3592 g1f3 c5d4 f3d4 f8c5
3. 18 1 5704 g1f3 c5d4 f3d4 f8c5
4& 29 2 9776 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
4. 29 8 56016 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
4 exd5* 29 4 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
Move# 5 Target= 6000 Clock: 0
Qxd5* 29 4 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
Move# 5 Target= 6000 Clock: 0
5 dxc5* 29 4 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
Move# 6 Target= 6000 Clock: 0
Bxc5* 29 4 g1f3 c5d4 f3d4 f8c5 f1b5 b8d7
Move# 6 Target= 6000 Clock: 0
2. 0 0 2983 d1g4 d5e5 d2e4
3& -14 1 6727 d1g4 d5e5 g1e2 b8c6
3. -14 2 11378 d1g4 d5e5 g1e2 b8c6
4& -14 3 14958 d1g4 d5e5 g1e2
4& 16 5 23928 g1f3 b8c6 f1c4 d5d6 e1g1
4. 16 10 53386 g1f3 b8c6 f1c4 d5d6 e1g1
6 Ngf3* 16 4 g1f3 b8c6 f1c4 d5d6 e1g1
-----cut here-----
3) Missing feature: gnuan won't understand an xboard save file that
starts with a position diagram. It might be feasible to implement
this using the GetXGame() function that gnuchess already has.
--Tim
Technical Details
Message-ID:
<2e8iqb$s8g@src-news.pa.dec.com>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!emory!news-feed-1.peachnet.edu!concert!decwrl!src.dec.com!mannReferences:
<STURM.93Dec5213751@alice.fmi.uni-passau.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d71d,45009c96a1f7255f X-Google-Attributes: gid10d71d,public X-Google-ArrivalTime: 1993-12-10 13:18:47 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!emory!news-feed-1.peachnet.edu!concert!decwrl!src.dec.com!mann From: mann@src.dec.com (Tim Mann) Newsgroups: gnu.chess Subject: Re: Need help on using gnuan for own games. Date: 10 Dec 1993 01:19:07 GMT Organization: DEC Systems Research Center Lines: 203 Distribution: world Message-ID: <2e8iqb$s8g@src-news.pa.dec.com> References: <STURM.93Dec5213751@alice.fmi.uni-passau.de> NNTP-Posting-Host: cypress.pa.dec.com