a = black;
- do
+ while(1)
{
scanf("%s", s);
found = 0;
+ if (s[0] == '.')
+ break;
+
if (s[0] == '#')
{
for (sq = 0; sq < NO_SQUARES; sq++)
}
ClearCaptured();
+ continue;
}
- if (s[0] == 'c')
+ if (s[0] == 'c') {
a = otherside[a];
+ continue;
+ }
if (s[1] == '*')
{
break;
}
}
-
- c = -1;
- r = -1;
+ continue;
}
- else
- {
- c = COL_NAME(s[1]);
- r = ROW_NAME(s[2]);
+
+ c = COL_NUM(s[1]);
+ r = ROW_NUM(s[2]);
+
+ if ((c < 0) || (c >= NO_COLS) || (r < 0) || (r >= NO_ROWS)) {
+ continue;
}
- if ((c >= 0) && (c < NO_COLS) && (r >= 0) && (r < NO_ROWS))
- {
- sq = locn(r, c);
- color[sq] = a;
- board[sq] = no_piece;
+ sq = locn(r, c);
+ color[sq] = a;
+ board[sq] = no_piece;
- for (i = no_piece; i <= king; i++)
+ for (i = no_piece; i <= king; i++)
+ {
+ if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
{
- if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
- {
- if (s[3] == '+')
- board[sq] = promoted[i];
- else
- board[sq] = i;
+ if (s[3] == '+')
+ board[sq] = promoted[i];
+ else
+ board[sq] = i;
- found = 1;
- break;
- }
+ found = 1;
+ break;
}
-
- if (found == 0)
- color[sq] = neutral;
}
+
+ if (found == 0)
+ color[sq] = neutral;
}
- while (s[0] != '.');
for (sq = 0; sq < NO_SQUARES; sq++)
Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);