The formula is reversible for the somewhat-standard default position
notation, but that does not mean we should write silly things. As a
proof, if that was needed, the formula necessary to support the xboard
protocol is not reversible.
* XShogi is no longer included in the GNU Shogi source, it is
available as a separate source archive.
+* Minor code cleanups.
Changes in version 1.4.1 (01/2014):
if (f[1] == '*' || f[1] == '\'')
{
- c2 = COL_NAME(f[2]);
- r2 = ROW_NAME(f[3]);
+ c2 = COL_NUM(f[2]);
+ r2 = ROW_NUM(f[3]);
return ((NO_SQUARES + *fpiece) << 8) | locn(r2, c2);
}
else
{
- c1 = COL_NAME(f[1]);
- r1 = ROW_NAME(f[2]);
- c2 = COL_NAME(f[3]);
- r2 = ROW_NAME(f[4]);
+ c1 = COL_NUM(f[1]);
+ r1 = ROW_NUM(f[2]);
+ c2 = COL_NUM(f[3]);
+ r2 = ROW_NUM(f[4]);
p = (f[5] == '+') ? 0x80 : 0;
return (locn(r1, c1) << 8) | locn(r2, c2) | p;
}
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))
#define ROW_NAME(n) ('a' + NO_ROWS - 1 - n)
#define COL_NAME(n) ('1' + NO_COLS - 1 - n)
+#define ROW_NUM(c) ('a' + NO_ROWS - 1 - c)
+#define COL_NUM(c) ('1' + NO_COLS - 1 - c)
#if defined HASHFILE || defined CACHE
# define PTBLBDSIZE (NO_SQUARES + NO_PIECES)
}
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))
return 0;
}
- c1 = COL_NAME(s[0]);
- r1 = ROW_NAME(s[1]);
- c2 = COL_NAME(s[2]);
- r2 = ROW_NAME(s[3]);
+ c1 = COL_NUM(s[0]);
+ r1 = ROW_NUM(s[1]);
+ c2 = COL_NUM(s[2]);
+ r2 = ROW_NUM(s[3]);
*mv = (locn(r1, c1) << 8) | locn(r2, c2);
if (c == '?')