Article View: gnu.chess
Article #3214Re: UNTRUE -- gnuchess 4.075 defeats Crafty 14.4
From: Tim Mann
Date: Tue, 27 Jan 1998 00:00
Date: Tue, 27 Jan 1998 00:00
207 lines
7318 bytes
7318 bytes
I originally replied to this in private mail because I didn't realize
Tim Benham had also posted it to the newsgroups. Here is a more
detailed response than I sent him originally.
In article <6ae8rc$uti@dworkin.interact.net.au>, timben@dworkin.interact.net.au (Tim Benham) writes:
>From the Laws of Chess (FIDE):
>
>#6.8. A flag is considered to have fallen when the arbiter observes the
># fact or when a valid claim to that effect has been made by either
># player.
>
>If xboard is an arbiter, then it may stop the game. Otherwise it is up
>to the winner to claim.
>
>This may seem to be nitpicking, but it is of practical importance when
>trying to judge the relative strength of chess programs by running
>matches which aren't under continuous human observation.
xboard/WinBoard is not a FIDE arbiter. It is a GUI that makes it
more pleasant for people to play chess on a computer, either against a
chess engine running on the local machine or on a chess server.
When you are playing a friendly game against a chess engine on your
machine, it's annoying if the engine has a bug in its clock managment
and oversteps its time bounds, but I don't think it helps matters for
the GUI to call the engine's flag for you and force the game to end.
(In this case xboard does display "White's [Black's] flag has fallen",
but allows the game to continue.)
As a secondary, throw-in feature, xboard lets you set up a match
between two chess engines. Personally, I don't think it is terribly
useful for xboard to pretend it's a FIDE arbiter in this case either,
calling one engine's flag if it oversteps its time bounds. In fact,
it would be particularly obnoxious to do this, because GNU Chess has a
problem with its time management that causes it to run out of time on
the last or second-last move of the time control in almost every game.
No one is maintaining GNU Chess anymore, so automatically calling its
flag in this case is not going to exert pressure on its (nonexistent)
programmers to fix the bug. And it's certainly not something Bob
Hyatt wants when he is using GNU Chess as a sparring partner for
Crafty; if GNU Chess loses on time, that doesn't tell him anything
about the quality of Crafty's play.
Nevertheless, if you really want this feature, it's easy to add.
xboard/WinBoard is free software. The source code is provided so that
you can make improvements to it if you desire. However, I realize
that it's a large program (and not well structured or commented), so
it's much easier for me to code a small change than for someone else
to work out how. Here is a patch that will cause xboard/WinBoard to
call flags and end the game if the -autoflag option is turned on, even
in local computer/computer or human/computer matches. Note that it
also calls *your* flag if you are playing the computer and run out of
time. Fair is fair.
I've also included the patch for the "1-0 {Black mates}" bug that was
discussed earlier in this thread.
--Tim
--- backend.c 1997/11/18 19:07:43 1.95
+++ backend.c 1998/01/05 22:50:14 1.97
@@ -2952,7 +2952,7 @@
return;
} else if (strncmp(message, "checkmate", 9) == 0) {
if (WhiteOnMove(forwardMostMove)) {
- GameEnds(WhiteWins, "Black mates", GE_GNU);
+ GameEnds(BlackWins, "Black mates", GE_GNU);
} else {
GameEnds(WhiteWins, "White mates", GE_GNU);
}
--- backend.c 1998/01/06 01:01:16 1.98
+++ backend.c 1998/01/27 20:54:52
@@ -200,7 +200,7 @@
char *StrSave P((char *));
void GetTimeMark P((TimeMark *));
long SubtractTimeMarks P((TimeMark *, TimeMark *));
-void CheckFlags P((void));
+int CheckFlags P((void));
long NextTickLength P((long));
void CheckTimeControl P((void));
void show_bytes P((FILE *, char *, int));
@@ -222,6 +222,7 @@
#define GE_GNU 1
#define GE_PLAYER 2
#define GE_FILE 3
+#define GE_XBOARD 4
/* Maximum number of games in a cmail message */
#define CMAIL_MAX_GAMES 20
@@ -2830,6 +2831,8 @@
return;
}
+ if (gameMode == EndOfGame) return;
+
/*
* win, lose, draw, or draw offer
*/
@@ -7172,7 +7186,7 @@
#endif /*ATTENTION*/
}
-void CheckFlags()
+int CheckFlags()
{
if (whiteTimeRemaining <= 0) {
if (!whiteFlag) {
@@ -7182,10 +7196,15 @@
gameMode == IcsPlayingBlack && !blackFlag)
SendToICS("flag\n");
} else {
- if (blackFlag)
- DisplayTitle("Both flags fell");
- else
- DisplayTitle("White's flag fell");
+ if (blackFlag) {
+ DisplayTitle("Both flags fell");
+ } else {
+ DisplayTitle("White's flag fell");
+ if (appData.autoCallFlag) {
+ GameEnds(BlackWins, "Black wins on time", GE_XBOARD);
+ return TRUE;
+ }
+ }
}
}
}
@@ -7197,13 +7216,19 @@
gameMode == IcsPlayingWhite && !whiteFlag)
SendToICS("flag\n");
} else {
- if (whiteFlag)
- DisplayTitle("Both flags fell");
- else
- DisplayTitle("Black's flag fell");
+ if (whiteFlag) {
+ DisplayTitle("Both flags fell");
+ } else {
+ DisplayTitle("Black's flag fell");
+ if (appData.autoCallFlag) {
+ GameEnds(WhiteWins, "White wins on time", GE_XBOARD);
+ return TRUE;
+ }
+ }
}
}
}
+ return FALSE;
}
void CheckTimeControl()
@@ -7355,7 +7380,7 @@
!WhiteOnMove(currentMove));
}
- CheckFlags();
+ if (CheckFlags()) return;
tickStartTM = now;
intendedTickLength = NextTickLength(timeRemaining - fudge) + fudge;
@@ -7372,6 +7397,7 @@
{
long lastTickLength;
TimeMark now;
+ int flagged = FALSE;
GetTimeMark(&now);
@@ -7382,7 +7408,7 @@
} else {
blackTimeRemaining -= lastTickLength;
}
- CheckFlags();
+ flagged = CheckFlags();
}
CheckTimeControl();
if (!((gameMode == PlayFromGameFile) &&
@@ -7390,7 +7416,7 @@
DisplayBothClocks();
}
- if (!appData.clockMode) return;
+ if (flagged || !appData.clockMode) return;
switch (gameMode) {
case MachinePlaysBlack:
@@ -7443,10 +7469,10 @@
{
(void) StopClockTimer(); /* in case it was running already */
DisplayBothClocks();
- CheckFlags();
+ if (CheckFlags()) return;
if (!appData.clockMode) return;
- if (gameMode == AnalyzeMode || gameMode == AnalyzeFile ) return;
+ if (gameMode == AnalyzeMode || gameMode == AnalyzeFile ) return;
GetTimeMark(&tickStartTM);
intendedTickLength = NextTickLength(WhiteOnMove(forwardMostMove) ?
--
Tim Mann <mann@pa.dec.com>
http://www.research.digital.com/SRC/personal/Tim_Mann/
Technical Details
Message-ID:
<6ali84$qml@src-news.pa.dec.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6abukk$ro8@dworkin.interact.net.au> <6ac0fa$q64@src-news.pa.dec.com> <6ae8rc$uti@dworkin.interact.net.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110df2,2f0fc333237f1d45 X-Google-Attributes: gid110df2,public X-Google-Thread: 10d71d,2f0fc333237f1d45 X-Google-Attributes: gid10d71d,public From: mann@pa.dec.com (Tim Mann) Subject: Re: UNTRUE -- gnuchess 4.075 defeats Crafty 14.4 Date: 1998/01/27 Message-ID: <6ali84$qml@src-news.pa.dec.com> X-Deja-AN: 319773283 References: <6abukk$ro8@dworkin.interact.net.au> <6ac0fa$q64@src-news.pa.dec.com> <6ae8rc$uti@dworkin.interact.net.au> Reply-To: mann@pa.dec.com Organization: Digital Equipment Corp., Systems Research Center Newsgroups: gnu.chess,rec.games.chess.computer