🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #4572

patch for gnuan

#4572
From: Tony Acero
Date: Mon, 13 Feb 1995 02:37
117 lines
5624 bytes
Here are a couple of patches to gnuan.c and book.c.  They are
vs. gnuchess 4.0 pl73.  They correct several bugs under Linux (and
probably other OSes, the fixes don't appear to be Linux specific):

1.  The percentage of game moves predicted by gnuan (for each side) is
now reported correctly.

2.  It is now possible to enter a negative integer at the time prompt
to indicate seconds of thinking time (as opposed to minutes).

3.  If gnuan is told to go to the end of the game (N > game moves), it
now calculates a response to each half-move (as it should) instead of
saying the rest of the moves are "book" after calculating the first
move.  NOTE: I'm not positive that my patch to book.c is correct, but
book.c seems to work correctly after some testing with gnuchess and
gnuchessx as well as gnuan.

Instructions:
	0. save this message to a file and delete everything above the
	'cut here' line (after having memorized these instructions :-).
	1. cd to the gnuchess src directory.
	2. patch -p1 < patchfile
	3. recompile and enjoy

Tony Acero

Anibal Antonio Acero (Tony) (LLama) | Stone age or space age, man will be ask-
      a-acero@uchicago.edu          | ing the same question as his grandparents
___W(312)702-8214 H(312)752-5464____| before him and as his grandchildren after
him: "What star is that?" -- H.A. Rey, _The Stars, A New Way to See Them_

Great quote seen in sci.astro:
 "That's the whole problem with science.  You've got a bunch of
  empiricists trying to describe things of unimaginable wonder."
                                                  -Calvin


/* ================= cut here =============== */

diff --unified src-test/book.c src-new/book.c
--- src-test/book.c	Mon Sep 19 05:23:04 1994
+++ src-new/book.c	Sun Feb 12 22:08:27 1995
@@ -1172,9 +1172,9 @@
     while (true)
       {
 	  if (read (gfd, &OBB[x], sizeof (struct gdxdata)) == 0)
-	        return;
+	        return false;
 	  if (OBB[x].bmove == 0)
-	      return;
+	      return false;
 
 
 	  if (OBB[x].hashkey == (utshort) (lts (hashkey)) && OBB[x].hashbd == hashbd)
diff --unified src-test/gnuan.c src-new/gnuan.c
--- src-test/gnuan.c	Mon Sep 19 05:23:06 1994
+++ src-new/gnuan.c	Sun Feb 12 22:44:05 1995
@@ -141,7 +141,7 @@
 static SHORT GNUANdepth;	/*Search depth override         */
 static SHORT GNUANcurrmove;	/* current move within base  */
 static SHORT GNUANbasemove;	/* base for curr move set    */
-static SHORT GNUANmovecnt;	/* movecnt within base frame                          */
+static SHORT GNUANmovecnt;	/* movecnt within base frame        */
 static SHORT GNUANnextstop = 0;	/*loop control proceed to this move */
 SHORT GNUANtop;			/* # movees in adjlist   */
 SHORT GNUANtopLim = 0;			/* # movees in adjlist   */
@@ -755,13 +755,13 @@
     if (TCflag)
       {
 	  TimeControl.moves[white] = TimeControl.moves[black] = TCmoves;
-	  TimeControl.clock[white] = TimeControl.clock[black] = 6000L * TCminutes;
+	  TimeControl.clock[white] = TimeControl.clock[black] = 6000L * TCminutes+100L*TCseconds;
       }
     else
       {
 	  TimeControl.moves[white] = TimeControl.moves[black] = 0;
 	  TimeControl.clock[white] = TimeControl.clock[black] = 0;
-	  MaxResponseTime = 6000L * TCminutes;
+	  MaxResponseTime = 6000L * TCminutes + 100L*TCseconds;
       }
     et = 0;
     ElapsedTime (1);
@@ -1223,6 +1223,7 @@
 	  fflush (fpout);
 	  Sdepth = 0;
 	  ft = 0;
+	  same_moves[computer]++;
       }
     else
       {
@@ -1409,8 +1410,9 @@
     else
 	flag.post = false;
     printf ("\nYou will search to %d half moves\n", search_depth);
-    printf ("\nWith no search taking more than %d minutes\n", max_minutes);
+    printf ("\nWith no search taking more than %d:%02d minutes\n", max_minutes, max_seconds);
     TCminutes = max_minutes;
+    TCseconds = max_seconds;
 
     fprintf (fpout, "\n\n");
 
@@ -1743,8 +1745,8 @@
 	  Undid = false;
       }
 
-    move_percent[white] = ((float) same_moves[white]) * 100 / (float) GNUANmovecnt;
-    move_percent[black] = ((float) same_moves[black]) * 100 / (float) GNUANmovecnt;
+    move_percent[white] = ((float) same_moves[white]) * 200 / (float) (GNUANmovecnt+(GNUANmovecnt%2?1:0));
+    move_percent[black] = ((float) same_moves[black]) * 200 / (float) (GNUANmovecnt - (GNUANmovecnt%2?1:0));
     fprintf (fpout, "\n           White's percentage was %5.2f%%.     Black's percentage was %5.2f%%.\n", move_percent[white], move_percent[black]);
     time (&end_time);
     elapsed_time = end_time - start_time;
-- 
Anibal Antonio Acero (Tony) (LLama) | Stone age or space age, man will be ask-
      a-acero@uchicago.edu          | ing the same question as his grandparents
___W(312)702-8214 H(312)752-5464____| before him and as his grandchildren after
him: "What star is that?" -- H.A. Rey, _The Stars, A New Way to See Them_
Technical Details
Message-ID: <D3x3Az.Kwy@midway.uchicago.edu>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!msunews!uchinews!rainbow.uchicago.edu!acero

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,2fcf4fcc00cbadc4,start
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1995-02-12 18:37:46 PST
Newsgroups: gnu.chess
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!msunews!uchinews!rainbow.uchicago.edu!acero
From: acero@rainbow.uchicago.edu (Tony Acero)
Subject: patch for gnuan
X-Nntp-Posting-Host: rainbow.uchicago.edu
Message-ID: <D3x3Az.Kwy@midway.uchicago.edu>
Keywords: patch,gnuchess,gnuan,bug
Sender: news@midway.uchicago.edu (News Administrator)
Organization: Advanced Research Systems, The Univ. of Chicago
Date: Mon, 13 Feb 1995 02:37:46 GMT
Lines: 117