"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/frontend/move.cc" between
gnuchess-6.2.5.tar.gz and gnuchess-6.2.6.tar.gz

About: GNU Chess is a chess-playing program.

move.cc  (gnuchess-6.2.5):move.cc  (gnuchess-6.2.6)
/* move.c /* move.c
GNU Chess frontend GNU Chess frontend
Copyright (C) 2001-2011 Free Software Foundation, Inc. Copyright (C) 2001-2020 Free Software Foundation, Inc.
GNU Chess is based on the two research programs GNU Chess is based on the two research programs
Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
skipping to change at line 522 skipping to change at line 522
case 'Q': case 'Q':
return queen; return queen;
case 'K': case 'K':
return king; return king;
case 'P': case 'P':
return pawn; return pawn;
} }
return empty; return empty;
} }
leaf * ValidateMove (char *s) leaf * ValidateMove (char *s, char *cleanMove)
/************************************************************************* /*************************************************************************
* *
* This routine takes a string and check to see if it is a legal move. * This routine takes a string and check to see if it is a legal move.
* Note. At the moment, we accept 2 types of moves notation. * Note. At the moment, we accept 2 types of moves notation.
* 1. e2e4 format. 2. SAN format. (e4) * 1. e2e4 format. 2. SAN format. (e4)
* *
**************************************************************************/ **************************************************************************/
{ {
short f, t, side, rank, file, fileto; short f, t, side, rank, file, fileto;
short piece, piece2, kount; short piece, piece2, kount;
skipping to change at line 562 skipping to change at line 562
p = mvstr; p = mvstr;
do do
{ {
if (*s != 'x' && *s != '+' && *s != '=' && !isspace(*s)) if (*s != 'x' && *s != '+' && *s != '=' && !isspace(*s))
*p++ = *s; *p++ = *s;
} while (*s++ != '\0' ); } while (*s++ != '\0' );
/* Flush castles that check */ /* Flush castles that check */
if (mvstr[strlen(mvstr)-1] == '+' || mvstr[strlen(mvstr)-1] == '#' || if (mvstr[strlen(mvstr)-1] == '+' || mvstr[strlen(mvstr)-1] == '#' ||
mvstr[strlen(mvstr)-1] == '=') mvstr[strlen(mvstr)-1] = '\000'; mvstr[strlen(mvstr)-1] == '=') mvstr[strlen(mvstr)-1] = '\000';
if (cleanMove) strcpy(cleanMove, mvstr);
/* Check for castling */ /* Check for castling */
if (strcmp (mvstr, "O-O") == 0 || strcmp (mvstr, "o-o") == 0 || if (strcmp (mvstr, "O-O") == 0 || strcmp (mvstr, "o-o") == 0 ||
strcmp (mvstr, "0-0") == 0) strcmp (mvstr, "0-0") == 0)
{ {
if (cleanMove) strcpy(cleanMove, "O-O");
if (side == white) if (side == white)
{ {
f = 4; t = 6; f = 4; t = 6;
} }
else else
{ {
f = 60; t = 62; f = 60; t = 62;
} }
return (IsInMoveList (1, f, t, ' ')); return (IsInMoveList (1, f, t, ' '));
} }
if (strcmp (mvstr, "O-O-O") == 0 || strcmp (mvstr, "o-o-o") == 0 || if (strcmp (mvstr, "O-O-O") == 0 || strcmp (mvstr, "o-o-o") == 0 ||
strcmp (mvstr, "0-0-0") == 0) strcmp (mvstr, "0-0-0") == 0)
{ {
if (cleanMove) strcpy(cleanMove, "O-O-O");
if (side == white) if (side == white)
{ {
f = 4; t = 2; f = 4; t = 2;
} }
else else
{ {
f = 60; t = 58; f = 60; t = 58;
} }
return (IsInMoveList (1, f, t, ' ')); return (IsInMoveList (1, f, t, ' '));
} }
 End of changes. 5 change blocks. 
2 lines changed or deleted 5 lines changed or added

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