updated INSTALL, NEWS and other files for new release
[xboard.git] / common.h
index fc2b999..5e51bfd 100644 (file)
--- a/common.h
+++ b/common.h
@@ -86,6 +86,8 @@ int pclose(FILE *);
 #define FALSE 0\r
 #endif\r
 \r
+#define UNKNOWN -1 /* [HGM] nps */\r
+\r
 #if !HAVE_RANDOM\r
 # if HAVE_RAND48\r
 #  define srandom srand48\r
@@ -98,12 +100,33 @@ int pclose(FILE *);
 \r
 /* End compatibility grunge */\r
 \r
-#define PROTOVER                2       /* engine protocol version */\r
-\r
-#define BOARD_SIZE              12                     /* [HGM] for in declarations */\r
-#define BOARD_WIDTH             (appData.NrFiles)      /* [HGM] made user adjustable */\r
-#define BOARD_HEIGHT            (appData.NrRanks)\r
-#define ONE                     ('1'-(BOARD_HEIGHT>9)) /* [HGM] foremost board rank */\r
+#define PROTOVER                2       /* engine protocol version */
+
+// [HGM] license: Messages that engines must print to satisfy their license requirements for patented variants\r
+#define GOTHIC "Gothic Chess (see www.GothicChess.com) is licensed under U.S. Patent #6,481,716 by Ed Trice"\r
+#define NOFALCON "Falcon Chess (see www.chessvariants.com) is licensed under U.S. Patent #5,690,334 by George W. Duke"\r
+\r
+/* [HGM] Some notes about board sizes:\r
+   In games that allow piece drops, the holdings are considered part of the\r
+   board, in the leftmost and rightmost two files. This way they are\r
+   automatically part of the game-history states, and enjoy all display\r
+   functions (including drag-drop and click-click moves to the regular part\r
+   of the board). The drawback of this is that the internal numbering of\r
+   files starts at 2 for the a-file if holdings are displayed. To ensure\r
+   consistency, this shifted numbering system is used _everywhere_ in the\r
+   code, and conversion to the 'normal' system only takes place when the\r
+   file number is converted to or from ASCII (by redefining the character\r
+   constant 'a'). This works because Winboard only communicates with the\r
+   outside world in ASCII. In a similar way, the different rank numbering\r
+   systems (starting at rank 0 or 1) are implemented by redefining '1'.\r
+*/\r
+#define BOARD_SIZE              16            /* [HGM] for in declarations */\r
+#define BOARD_HEIGHT (gameInfo.boardHeight)   // [HGM] made user adjustable \r
+#define BOARD_WIDTH  (gameInfo.boardWidth + 2*gameInfo.holdingsWidth)   \r
+#define BOARD_LEFT   (gameInfo.holdingsWidth) // [HGM] play-board edges     \r
+#define BOARD_RGHT   (gameInfo.boardWidth + gameInfo.holdingsWidth)\r
+#define ONE          ('1'-(BOARD_HEIGHT>9))   // [HGM] foremost board rank  \r
+#define AAA          ('a'-BOARD_LEFT)         // [HGM] leftmost board file  \r
 #define DROP_RANK               -3\r
 #define MAX_MOVES              1000\r
 #define MSG_SIZ                        512\r
@@ -155,7 +178,7 @@ int pclose(FILE *);
 #define ZIPPY_GAME_START ""\r
 #define ZIPPY_ADJOURN FALSE\r
 #define ZIPPY_ABORT FALSE\r
-#define ZIPPY_VARIANTS "normal"\r
+#define ZIPPY_VARIANTS "normal,fischerandom,crazyhouse,losers,suicide,3checks,twokings,bughouse,shatranj"\r
 #define ZIPPY_MAX_GAMES 0\r
 #define ZIPPY_REPLAY_TIMEOUT 120\r
 \r
@@ -168,24 +191,29 @@ typedef enum {
   } GameMode;\r
 \r
 typedef enum {\r
-    WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, \r
-#ifdef FAIRY\r
-    WhiteCardinal, WhiteMarshall, WhiteFairyPawn, WhiteFairyKnight,\r
-    WhiteFairyBishop, WhiteFairyRook, WhiteFairyCardinal, WhiteFairyMarshall,\r
-    WhiteFairyQueen, WhiteFairyKing,\r
-#endif\r
-    WhiteQueen, WhiteKing,\r
-    BlackPawn, BlackKnight, BlackBishop, BlackRook,\r
-#ifdef FAIRY\r
-    BlackCardinal, BlackMarshall, BlackFairyPawn, BlackFairyKnight,\r
-    BlackFairyBishop, BlackFairyRook, BlackFairyCardinal, BlackFairyMarshall,\r
-    BlackFairyQueen, BlackFairyKing,\r
-#endif\r
-    BlackQueen, BlackKing,\r
+    /* [HGM] the order here is crucial for Crazyhouse & Shogi: */\r
+    /* only the first N pieces can go into the holdings, and   */\r
+    /* promotions in those variants shift P-W to U-S           */\r
+    WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, \r
+    WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan, \r
+    WhiteCannon, WhiteNightrider, WhiteCardinal, WhiteDragon, WhiteGrasshopper,\r
+    WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteKing,\r
+    BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen,\r
+    BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan, \r
+    BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper,\r
+    BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackKing,\r
     EmptySquare, \r
-    ClearBoard, WhitePlay, BlackPlay /*for use on EditPosition menus*/\r
+    ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/\r
   } ChessSquare;\r
 \r
+/* [HGM] some macros that can be used as prefixes to convert piece types */\r
+#define WHITE_TO_BLACK (int)BlackPawn - (int)WhitePawn + (int)\r
+#define BLACK_TO_WHITE (int)WhitePawn - (int)BlackPawn + (int)\r
+#define PROMOTED       (int)WhiteDragon - (int)WhiteRook + (int)\r
+#define DEMOTED        (int)WhiteRook - (int)WhiteDragon + (int)\r
+#define SHOGI          (int)EmptySquare + (int)\r
+\r
+\r
 typedef ChessSquare Board[BOARD_SIZE][BOARD_SIZE];\r
 \r
 typedef enum {\r
@@ -197,14 +225,10 @@ typedef enum {
     BlackHSideCastleFR, BlackASideCastleFR, \r
     WhitePromotionKnight, WhitePromotionBishop,\r
     WhitePromotionRook, WhitePromotionQueen, WhitePromotionKing,\r
-#ifdef FAIRY\r
-    WhitePromotionChancellor, WhitePromotionArchbishop,\r
-#endif\r
+    WhitePromotionChancellor, WhitePromotionArchbishop, WhitePromotionCentaur,\r
     BlackPromotionKnight, BlackPromotionBishop,\r
     BlackPromotionRook, BlackPromotionQueen, BlackPromotionKing,\r
-#ifdef FAIRY\r
-    BlackPromotionChancellor, BlackPromotionArchbishop,\r
-#endif\r
+    BlackPromotionChancellor, BlackPromotionArchbishop, BlackPromotionCentaur,\r
     WhiteCapturesEnPassant, BlackCapturesEnPassant,\r
     WhiteDrop, BlackDrop, \r
     NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove,\r
@@ -243,52 +267,29 @@ typedef enum {
     VariantShatranj,     /* Unsupported (ICC wild 28) */\r
     Variant29,           /* Temporary name for possible future ICC wild 29 */\r
     Variant30,           /* Temporary name for possible future ICC wild 30 */\r
-#ifdef FAIRY\r
-    VariantShogi,        /* [HGM] To be supported in next version */\r
-    VariantXiangqi,\r
-    VariantCourier,\r
-    VariantGothic,\r
-    VariantCapablanca,\r
-    VariantFairy,        /* [HGM] allow more piece types */\r
-#else\r
     Variant31,           /* Temporary name for possible future ICC wild 31 */\r
     Variant32,           /* Temporary name for possible future ICC wild 32 */\r
-    Variant33,\r
+    Variant33,           /* Temporary name for possible future ICC wild 33 */\r
     Variant34,           /* Temporary name for possible future ICC wild 34 */\r
     Variant35,           /* Temporary name for possible future ICC wild 35 */\r
     Variant36,           /* Temporary name for possible future ICC wild 36 */\r
-#endif\r
+    VariantShogi,        /* [HGM] added variants */\r
+    VariantXiangqi,\r
+    VariantCourier,\r
+    VariantGothic,\r
+    VariantCapablanca,\r
+    VariantKnightmate,\r
+    VariantFairy,        \r
+    VariantCylinder,\r
+    VariantFalcon,\r
+    VariantCapaRandom,\r
+    VariantBerolina,\r
+    VariantJanus,\r
+    VariantSuper,\r
+    VariantGreat,\r
     VariantUnknown       /* Catchall for other unknown variants */\r
 } VariantClass;\r
 \r
-#ifdef FAIRY\r
-#define VARIANT_NAMES { \\r
-  "normal", \\r
-  "normal", \\r
-  "wildcastle", \\r
-  "nocastle", \\r
-  "fischerandom", \\r
-  "bughouse", \\r
-  "crazyhouse", \\r
-  "losers", \\r
-  "suicide", \\r
-  "giveaway", \\r
-  "twokings", \\r
-  "kriegspiel", \\r
-  "atomic", \\r
-  "3check", \\r
-  "shatranj", \\r
-  "wild29", \\r
-  "wild30", \\r
-  "shogi", \\r
-  "xiangqi", \\r
-  "courier", \\r
-  "gothic", \\r
-  "capablanca", \\r
-  "fairy", \\r
-  "unknown" \\r
-}\r
-#else\r
 #define VARIANT_NAMES { \\r
   "normal", \\r
   "normal", \\r
@@ -313,9 +314,22 @@ typedef enum {
   "wild34", \\r
   "wild35", \\r
   "wild36", \\r
+  "shogi", \\r
+  "xiangqi", \\r
+  "courier", \\r
+  "gothic", \\r
+  "capablanca", \\r
+  "knightmate", \\r
+  "fairy", \\r
+  "cylinder", \\r
+  "falcon",\\r
+  "caparandom",\\r
+  "berolina",\\r
+  "janus",\\r
+  "super",\\r
+  "great",\\r
   "unknown" \\r
 }\r
-#endif\r
 \r
 typedef struct {\r
 #if !defined(_amigados)\r
@@ -467,6 +481,7 @@ typedef struct {
     int firstProtocolVersion;\r
     int secondProtocolVersion;\r
     Boolean showButtonBar;\r
+    Boolean icsEngineAnalyze; \r
 \r
     /* [AS] New properties (down to the "ZIPPY" part) */\r
     Boolean firstScoreIsAbsolute;  /* If true, engine score is always from white side */\r
@@ -516,8 +531,16 @@ typedef struct {
     /* [HGM] Board size */\r
     int NrFiles;\r
     int NrRanks;\r
+    int holdingsSize;\r
     int matchPause;\r
+    char * pieceToCharTable;\r
+    Boolean allWhite;\r
+    Boolean upsideDown;\r
+    Boolean alphaRank;\r
     Boolean testClaims;\r
+    Boolean checkMates;\r
+    Boolean materialDraws;\r
+    Boolean trivialDraws;\r
     int ruleMoves;\r
     int drawRepeats;\r
 \r
@@ -539,6 +562,31 @@ typedef struct {
     int zippyMaxGames;\r
     int zippyReplayTimeout; /*seconds*/\r
 #endif\r
+\r
+    char *serverMovesName;\r
+    Boolean suppressLoadMoves;\r
+    int serverPause;\r
+    int firstTimeOdds;\r
+    int secondTimeOdds;\r
+    int timeOddsMode;\r
+    int firstAccumulateTC;\r
+    int secondAccumulateTC;\r
+    int firstNPS;\r
+    int secondNPS;\r
+    Boolean autoKibitz;\r
+    int engineComments;\r
+    char *userName;\r
+    int rewindIndex;    /* [HGM] autoinc   */\r
+    int sameColorGames; /* [HGM] alternate */\r
+    int smpCores;       /* [HGM] SMP       */\r
+    char *egtFormats;\r
+    int niceEngines;    /* [HGM] nice      */\r
+    char *firstLogo;    /* [HGM] logo      */\r
+    char *secondLogo;\r
+    Boolean autoLogo;\r
+    Boolean noGUI;      /* [HGM] fast: suppress all display updates */\r
+    char *firstOptions; /* [HGM] options   */\r
+    char *secondOptions;\r
 } AppData, *AppDataPtr;\r
 \r
 /* [AS] PGN tags (for showing in the game list) */\r
@@ -580,7 +628,13 @@ typedef struct {
     int blackRating;    /* -1 if unknown */\r
     VariantClass variant;\r
     char *outOfBook;    /* [AS] Move and score when engine went out of book */\r
+    int boardWidth;     /* [HGM] adjustable board size */\r
+    int boardHeight;\r
+/* [HGM] For Shogi and Crazyhouse: */\r
+    int holdingsSize;  /* number of different piece types in holdings       */\r
+    int holdingsWidth; /* number of files left and right of board, 0 or 2   */\r
 } GameInfo;\r
 \r
 \r
 #endif\r
+\r