🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #6045

Minor changes to 3.1

#6045
From: Longshot
Date: Fri, 05 Apr 1991 22:56
346 lines
9432 bytes
I have made a few changes to the display-oriented files in gnuchess 3.1.
A summary and patch'able diffs follows.

Randy

SUMMARY

+	Fixed bug in ListGame() that listed White's first move on
	a line by itself, with incorrect indention, followed by lines
	of Black move in left column and White in right column. This
	was giving Black's nth move on the same lines as White's
	(n+1)th.

+	Added functionality to name of list file, as per encouragement
	of fellow enthusiast. A call to ListGame() now confirms player's
	desire to produce a listing, then asks for a file name, allowing
	chess.lst as a default. This allows more friendly interface to
	having several listings lying around, and removes the chance that
	a "quit" command will accidentally overwrite a desired existing
	chess.lst.

+	Added a call to refresh() in the quit sequence. The program was
	moving the cursor to the bottom left corner of the screen, but
	with out the call to refresh(), it was not actually being carried
	out on-screen. Personally, quitting the game with the cursor
	in the middle of the board, halfway up my screen, was darn
	annoying.

These changes do not affect the game's skill or play. It is up to the
authors as to whether they are included in the next release.

Feed the following to "patch -p0" in the directory where your source
resides:

---CUT------CUT------CUT------CUT------CUT------CUT------CUT------CUT---
*** nondsp.c~	Fri Apr  5 16:34:12 1991
--- nondsp.c	Fri Apr  5 16:20:09 1991
***************
*** 691,705 ****
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
        if ((i % 2) == 0)
  	fprintf (fd, "         ");
        else
  	fprintf (fd, "\n");
-       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
- 	       GameList[i].score, GameList[i].depth,
- 	       GameList[i].nodes, GameList[i].time);
      }
-   fprintf (fd, "\n\n");
    fclose (fd);
  }
  
--- 691,704 ----
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
+       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
+ 	       GameList[i].score, GameList[i].depth,
+ 	       GameList[i].nodes, GameList[i].time);
        if ((i % 2) == 0)
  	fprintf (fd, "         ");
        else
  	fprintf (fd, "\n");
      }
    fclose (fd);
  }
  

*** nuxdsp.c~	Fri Apr  5 16:34:03 1991
--- nuxdsp.c	Fri Apr  5 16:27:58 1991
***************
*** 128,137 ****
--- 128,138 ----
  {
    ListGame ();
    gotoXY (1, 24);
  #ifndef MSDOS
    nocrmode ();
+   refresh();
    endwin ();
  #endif /* MSDOS */
    exit (0);
  }
  
***************
*** 1133,1176 ****
  void
  ListGame (void)
  {
    FILE *fd;
    char fname[256];
!   char *tmp;
    short i, f, t;
  
    if (tmp = getenv ("HOME"))
      strcpy (fname, tmp);
    else
      fname[0] = '\0';
    strcat (fname, "/chess.lst");
  
    if (fd = fopen (fname, "w"))
      ShowMessage ("Writing ~/chess.lst");
    else
      {
        ShowMessage ("Cannot write ~/chess.lst");
        return;
      }
  
    fprintf (fd, "\n");
    fprintf (fd, "       score  depth   nodes  time         ");
    fprintf (fd, "       score  depth   nodes  time\n");
    for (i = 1; i <= GameCnt; i++)
      {
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
        if ((i % 2) == 0)
  	fprintf (fd, "\n");
        else
  	fprintf (fd, "         ");
-       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
- 	       GameList[i].score, GameList[i].depth,
- 	       GameList[i].nodes, GameList[i].time);
      }
-   fprintf (fd, "\n\n");
    fclose (fd);
    ShowMessage ("~/chess.lst written");
  }
  
  void
--- 1134,1206 ----
  void
  ListGame (void)
  {
    FILE *fd;
    char fname[256];
!   char *tmp,y_or_n_p,tmp2[256];
    short i, f, t;
  
+   ShowMessage("List game? (y or n) ");
+   y_or_n_p = getchar();
+   ShowMessage("                     ");
+   if ((y_or_n_p == 'n') || (y_or_n_p == 'N')) return;
+   
+   bzero(tmp2,256);
+   ShowMessage("As: (~/chess.lst) ");
+   scanz("%s",tmp2);
+   
+   if (strlen(tmp2) == 0)
+     {
        if (tmp = getenv ("HOME"))
  	strcpy (fname, tmp);
        else
  	fname[0] = '\0';
        strcat (fname, "/chess.lst");
        
+       tmp = (char *)malloc(256);
+       sprintf(tmp,"~/chess.lst written");
        if (fd = fopen (fname, "w"))
  	ShowMessage ("Writing ~/chess.lst");
        else
  	{
  	  ShowMessage ("Cannot write ~/chess.lst");
  	  return;
  	}
+     }
+   else
+     {
+       tmp = (char *)malloc(256);
+       if (fd = fopen(tmp2,"w"))
+ 	{
+ 	  sprintf(tmp,"Writing %s",tmp2);
+ 	  ShowMessage(tmp);
+ 	  sprintf(tmp,"%s written",tmp2);
+ 	}
+       else
+ 	{
+ 	  sprintf(tmp,"Cannot write %s",tmp2);
+ 	  ShowMessage(tmp);
+ 	  return;
+ 	}
+     }
  
    fprintf (fd, "\n");
    fprintf (fd, "       score  depth   nodes  time         ");
    fprintf (fd, "       score  depth   nodes  time\n");
    for (i = 1; i <= GameCnt; i++)
      {
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
+       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
+ 	       GameList[i].score, GameList[i].depth,
+ 	       GameList[i].nodes, GameList[i].time);
        if ((i % 2) == 0)
  	fprintf (fd, "\n");
        else
  	fprintf (fd, "         ");
      }
    fclose (fd);
    ShowMessage ("~/chess.lst written");
  }
  
  void
*** uxdsp.c~	Fri Apr  5 16:33:52 1991
--- uxdsp.c	Fri Apr  5 15:49:43 1991
***************
*** 92,101 ****
--- 92,102 ----
  {
    ListGame ();
    gotoXY (1, 24);
  #ifndef MSDOS
    nocrmode ();
+   refresh();
    endwin ();
  #endif /* MSDOS */
    exit (0);
  }
  
***************
*** 967,1012 ****
  void
  ListGame (void)
  {
    FILE *fd;
    char fname[256];
!   char *tmp;
    short i, f, t;
  
    if (tmp = getenv ("HOME"))
      strcpy (fname, tmp);
    else
      fname[0] = '\0';
    strcat (fname, "/chess.lst");
  
    if (fd = fopen (fname, "w"))
      ShowMessage ("Writing ~/chess.lst");
    else
      {
        ShowMessage ("Cannot write ~/chess.lst");
        return;
      }
  
    fprintf (fd, "\n");
    fprintf (fd, "       score  depth   nodes  time         ");
    fprintf (fd, "       score  depth   nodes  time\n");
    for (i = 1; i <= GameCnt; i++)
      {
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
        if ((i % 2) == 0)
  	fprintf (fd, "\n");
        else
  	fprintf (fd, "         ");
-       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
- 	       GameList[i].score, GameList[i].depth,
- 	       GameList[i].nodes, GameList[i].time);
      }
-   fprintf (fd, "\n\n");
    fclose (fd);
!   ShowMessage ("~/chess.lst written");
  }
  
  void
  Undo (void)
  
--- 968,1042 ----
  void
  ListGame (void)
  {
    FILE *fd;
    char fname[256];
!   char *tmp,y_or_n_p,tmp2[256];
    short i, f, t;
  
+   ShowMessage("List game? (y or n) ");
+   y_or_n_p = getchar();
+   ShowMessage("                     ");
+   if ((y_or_n_p == 'n') || (y_or_n_p == 'N')) return;
+ 
+   bzero(tmp2,256);
+   ShowMessage("As: (~/chess.lst) ");
+   scanz("%s",tmp2);
+ 
+   if (strlen(tmp2) == 0)
+     {
        if (tmp = getenv ("HOME"))
  	strcpy (fname, tmp);
        else
  	fname[0] = '\0';
        strcat (fname, "/chess.lst");
        
+       tmp = (char *)malloc(256);
+       sprintf(tmp,"~/chess.lst written");
        if (fd = fopen (fname, "w"))
  	ShowMessage ("Writing ~/chess.lst");
        else
  	{
  	  ShowMessage ("Cannot write ~/chess.lst");
  	  return;
  	}
+     }
+   else
+     {
+       tmp = (char *)malloc(256);
+       if (fd = fopen(tmp2,"w"))
+ 	{
+ 	  sprintf(tmp,"Writing %s",tmp2);
+ 	  ShowMessage(tmp);
+ 	  sprintf(tmp,"%s written",tmp2);
+ 	}
+       else
+ 	{
+ 	  sprintf(tmp,"Cannot write %s",tmp2);
+ 	  ShowMessage(tmp);
+ 	  return;
+ 	}
+     }
  
    fprintf (fd, "\n");
    fprintf (fd, "       score  depth   nodes  time         ");
    fprintf (fd, "       score  depth   nodes  time\n");
    for (i = 1; i <= GameCnt; i++)
      {
        f = GameList[i].gmove >> 8;
        t = (GameList[i].gmove & 0xFF);
        algbr (f, t, false);
+       fprintf (fd, "%5s  %5d     %2d %7ld %5d", mvstr[0],
+ 	       GameList[i].score, GameList[i].depth,
+ 	       GameList[i].nodes, GameList[i].time);
        if ((i % 2) == 0)
  	fprintf (fd, "\n");
        else
  	fprintf (fd, "         ");
      }
    fclose (fd);
!   ShowMessage (tmp);
  }
  
  void
  Undo (void)
  
Technical Details
Message-ID: <1991Apr5.225625.28240@uokmax.ecn.uoknor.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!samsung!cs.utexas.edu!usc!apple!uokmax!randy

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,6e4fad8816d74f7d,start
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1991-04-06 00:19:56 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!samsung!cs.utexas.edu!usc!apple!uokmax!randy
From: randy@uokmax.ecn.uoknor.edu (Longshot)
Newsgroups: gnu.chess
Subject: Minor changes to 3.1
Message-ID: <1991Apr5.225625.28240@uokmax.ecn.uoknor.edu>
Date: 5 Apr 91 22:56:25 GMT
Organization: Engineering Computer Network, University of Oklahoma, Norman, OK
Lines: 346