"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/frontend/epd.cc" between
gnuchess-6.2.8.tar.gz and gnuchess-6.2.9.tar.gz

About: GNU Chess is a chess-playing program.

epd.cc  (gnuchess-6.2.8):epd.cc  (gnuchess-6.2.9)
skipping to change at line 327 skipping to change at line 327
printf ("File position exceeded\n"); printf ("File position exceeded\n");
return; return;
} }
} }
ReadEPDFile (file, 0); ReadEPDFile (file, 0);
} }
ShowBoard (); ShowBoard ();
NewPosition (); NewPosition ();
} }
void SaveEPD (char *p) void EPD2str (char *pos)
/************************************************************************** /**************************************************************************
* *
* This routine appends the current position in EPD format into a file. * This routine writes the current position in EPD format into a string.
* *
**************************************************************************/ **************************************************************************/
{ {
char file[MAXSTR];
FILE *fp;
int r, c, sq, k; int r, c, sq, k;
char c1; char c1;
sscanf (p, "%s ", file);
fp = fopen (file, "a");
for (r = A8; r >= A1; r -= 8) for (r = A8; r >= A1; r -= 8)
{ {
k = 0; k = 0;
for (c = 0; c < 8; c++) for (c = 0; c < 8; c++)
{ {
sq = r + c; sq = r + c;
if (cboard[sq] == empty) if (cboard[sq] == empty)
k++; k++;
else else
{ {
if (k) if (k)
fprintf (fp, "%1d", k); sprintf(pos + strlen(pos), "%1d", k);
k = 0; k = 0;
c1 = notation[cboard[sq]]; c1 = notation[cboard[sq]];
if (BitPosArray[sq] & board.friends[black]) if (BitPosArray[sq] & board.friends[black])
c1 = tolower (c1); c1 = tolower (c1);
fprintf (fp, "%c", c1); sprintf(pos + strlen(pos), "%c", c1);
} }
} }
if (k) if (k)
fprintf (fp, "%1d", k); sprintf(pos + strlen(pos), "%1d", k);
if (r > A1) if (r > A1)
fprintf (fp, "/"); sprintf(pos + strlen(pos), "/");
} }
/* Print other stuff */ /* Print other stuff */
fprintf (fp, (board.side == white ? " w " : " b ")); sprintf(pos + strlen(pos), (board.side == white ? " w " : " b "));
if (board.flag & WKINGCASTLE) if (board.flag & WKINGCASTLE)
fprintf (fp, "K"); sprintf(pos + strlen(pos), "K");
if (board.flag & WQUEENCASTLE) if (board.flag & WQUEENCASTLE)
fprintf (fp, "Q"); sprintf(pos + strlen(pos), "Q");
if (board.flag & BKINGCASTLE) if (board.flag & BKINGCASTLE)
fprintf (fp, "k"); sprintf(pos + strlen(pos), "k");
if (board.flag & BQUEENCASTLE) if (board.flag & BQUEENCASTLE)
fprintf (fp, "q"); sprintf(pos + strlen(pos), "q");
if (!(board.flag & (WCASTLE | BCASTLE))) if (!(board.flag & (WCASTLE | BCASTLE)))
fprintf (fp, "-"); sprintf(pos + strlen(pos), "-");
sprintf(pos + strlen(pos), " %s", (board.ep > -1 ? algbr[board.ep] : "-"));
sprintf(pos + strlen(pos), " bm 1; id 1;");
}
fprintf (fp, " %s", (board.ep > -1 ? algbr[board.ep] : "-")); void SaveEPD (char *p)
fprintf (fp, " bm 1; id 1;"); /**************************************************************************
fprintf (fp, "\n"); *
* This routine appends the current position in EPD format into a file.
*
**************************************************************************/
{
char file[MAXSTR];
FILE *fp;
char pos[MAXSTR] = "";
EPD2str(pos);
sscanf (p, "%s ", file);
fp = fopen (file, "a");
fprintf(fp, "%s\n", pos);
fclose (fp); fclose (fp);
} }
 End of changes. 14 change blocks. 
29 lines changed or deleted 41 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)