XBoard: teach about xboard move notation.
authorYann Dirson <ydirson@free.fr>
Sat, 25 Jan 2014 18:20:57 +0000 (19:20 +0100)
committerYann Dirson <ydirson@free.fr>
Mon, 17 Feb 2014 22:05:19 +0000 (23:05 +0100)
Slight unfortunate side-effect: pat2inc requires a declaration of the xboard
flag, although it should really be constant there.

gnushogi/commondsp.c
gnushogi/gnushogi.h
gnushogi/makepattern.c

index c7940e3..addec64 100644 (file)
@@ -182,7 +182,7 @@ algbr(short f, short t, short flag)
         short piece = flag & pmask;
 
         mvstr[0][0] = pxx[piece];
-        mvstr[0][1] = '*';
+        mvstr[0][1] = xboard ? '@' : '*';
         mvstr[0][2] = COL_NAME(column(t));
         mvstr[0][3] = ROW_NAME(row(t));
         mvstr[0][4] = '\0';
index 322d32f..e5142f5 100644 (file)
@@ -182,10 +182,11 @@ extern void movealgbr(short m, char *s);
 #endif
 #define NO_SQUARES      (NO_COLS*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)
+#define ROW_NAME(n) ( xboard ? '1' + n : ('a' + NO_ROWS - 1 - n) )
+#define COL_NAME(n) ( xboard ? 'a' + n : ('1' + NO_COLS - 1 - n) )
+#define ROW_NUM(c) ( xboard ? c - '1' : ('a' + NO_ROWS - 1 - c) )
+#define COL_NUM(c) ( xboard ? c - 'a' : ('1' + NO_COLS - 1 - c) )
 
 #if defined HASHFILE || defined CACHE
 #  define PTBLBDSIZE (NO_SQUARES + NO_PIECES)
index ef1a937..b42a4d1 100644 (file)
@@ -37,6 +37,8 @@
 #define MAX_OPENING_SEQUENCE 20
 #define MAX_PATTERN          200
 
+short xboard = false;
+
 small_short pattern_data[MAX_PATTERN_DATA];
 
 /* minimal ShowMessage to avoid dependency on extraneous display code */