|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 10411 (0x28ab) Types: TextFile Names: »def.h«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Cchess/def.h«
/* C O R R E S P O N D E N C E C H E S S Version 1.00 * * These are the defines for cchess. * * (C) Apr 1986 - Jan Dithmar Wolter. */ typedef char boolean; /* For lint we always turn on the UNCHAR flag */ #ifdef lint #define UNCHAR #endif #ifdef UNCHAR typedef short schar; #else typedef char schar; #endif #ifdef USYS_5 #define index strchr #define NODUP2 #endif /* SCO seems to have problems with register directives in some situations */ #ifdef SCO #define REGISTER #else #define REGISTER register #endif /* Handle 4.3bsd as superset of 4.2bsd */ #ifdef U43BSD #define U42BSD #endif /* Fake the 4.2bsd directory routines for non-4.2bsd systems */ #ifndef U42BSD #define DIR FILE #define opendir(n) fopen(n,"r") #define telldir(f) ftell(f) #define seekdir(f,o) fseek(f,o,0) #define rewinddir(f) rewind(f) #define closedir(f) close(f) #endif U42BSD #define BELL '\007' #undef TRUE /* Some systems already define these, here or there */ #undef FALSE #define TRUE 1 #define FALSE 0 /* Code numbers for pieces */ #define WHITE (schar) 1 #define BLACK (schar) -1 #define SQ (schar) 0 /* Blank Square */ #define WK (schar) 1 /* White King */ #define WQ (schar) 2 /* White Queen */ #define WB (schar) 3 /* White Bishop */ #define WN (schar) 4 /* White Knight */ #define WR (schar) 5 /* White Rook */ #define WP (schar) 6 /* White Pawn */ #define WM (schar) 7 /* White Minister */ #define WE (schar) 8 /* White Elephant */ #define WD (schar) 9 /* White Duke */ #define WJ (schar) 10 /* White Jester */ #define WH (schar) 11 /* White Maharajah */ #define BK (schar) -1 /* Black King */ #define BQ (schar) -2 /* Black Queen */ #define BB (schar) -3 /* Black Bishop */ #define BN (schar) -4 /* Black Knight */ #define BR (schar) -5 /* Black Rook */ #define BP (schar) -6 /* Black Pawn */ #define BM (schar) -7 /* Black Minister */ #define BE (schar) -8 /* Black Elephant */ #define BD (schar) -9 /* Black Duke */ #define BJ (schar) -10 /* Black Jester */ #define BH (schar) -11 /* White Maharajah */ #define XX (schar) 99 /* Goofy piece used as place holder */ #define PIECES 11 /* Definition of options in "option" array */ #define OP_COLOR 0 /* Is first player white? */ #define Firstwhite option[OP_COLOR] #define HI_COLOR TRUE #define OP_PRIVATE 1 /* Is game Private? */ #define Private option[OP_PRIVATE] #define HI_PRIVATE TRUE #define OP_KIBITZ 2 /* Computer Kibitzing */ #define Help_me option[OP_KIBITZ] #define HI_KIBITZ TRUE #define OP_GAME 3 /* Major Variant */ #define Game_type option[OP_GAME] #define TY_MIXED 0 #define TY_CHESS 1 #define TY_KRIEGSPIEL 2 #define TY_SHATRANJ 3 #define TY_COURIER 4 #define TY_HALFBOARD 5 #define TY_KARMA 6 #define TY_RIFLE 7 #define TY_KAMIKAZI 8 #define TY_DOUBLE 9 #define TY_STEAMROLLER 10 #define TY_PROGRESSIVE 11 #define TY_MAHARAJAH 12 #define TY_LOSING 13 #define TY_CONVERSION 14 #define HI_GAME 14 #define OP_ROWS 4 /* Board Rows minus 1 */ #define Rows option[OP_ROWS] #define HI_ROWS 7 #define OP_COLS 5 /* Board Columns minus 1 */ #define Cols option[OP_COLS] #define HI_COLS 11 #define OP_BOARD 6 /* Is board uncheckered? */ #define Plain option[OP_BOARD] #define HI_BOARD TRUE #define OP_NAMES 7 /* Which names for pieces */ #define Language option[OP_NAMES] #define LG_ENGLISH 0 /* English */ #define LG_PERSIAN 1 /* Persian */ #define LG_FRENCH 2 /* French */ #define LG_GERMAN 3 /* German */ #define HI_NAMES 3 #define OP_VISIB 8 /* Kriegspiel? */ #define Kriegspiel option[OP_VISIB] #define HI_VISIB TRUE #define OP_CASTLE 9 /* Is castling illegal? */ #define Oldcastle option[OP_CASTLE] #define HI_CASTLE 9 #define OP_DPAWN 10 /* Double pawn move illegal? */ #define Oldpawn option[OP_DPAWN] #define HI_DPAWN TRUE #define OP_STRIP 11 /* Result if king is stripped */ #define Stripresult option[OP_STRIP] /* of all his forces: */ #define RE_DRAW 0 /* Game is a draw */ #define RE_WIN 1 /* Stripped side wins */ #define RE_LOSE 2 /* Stripped side loses */ #define RE_NONE 3 /* Game Continues */ #define RE_CANCEL 4 /* Game Cancelled */ #define flip(x) (((x) == RE_WIN) ? RE_LOSE : (((x) == RE_LOSE) ? RE_WIN : x)) #define HI_STRIP 3 #define OP_STALE 12 /* Result of Stalemate */ #define Staleresult option[OP_STALE] #define HI_STALE 2 #define OP_CAPTURE 13 /* How do pieces capture? */ #define Capture option[OP_CAPTURE] #define CA_NORMAL 0 /* The usual way */ #define CA_NONE 1 /* Capture not allowed */ #define CA_RIFLE 2 /* Rifle Chess */ #define CA_CONVERSION 3 /* Conversion Chess */ #define CA_KARMA 4 /* Karma Chess */ #define CA_KAMIKAZI 5 /* Kamikazi Chess */ #define HI_CAPTURE 5 #define OP_KCAPTURE 14 /* How do kings capture? */ #define Kcapture option[OP_KCAPTURE] #define HI_KCAPTURE 3 #define OP_PROMOTE 15 /* What can you promote to? */ #define Promotion option[OP_PROMOTE] #define PR_QRBN 0 /* Queen/Rook/Bishop/Knight */ #define PR_MINISTER 1 /* Minister Only */ #define PR_NONE 2 /* Stays as Pawn */ #define HI_PROMOTE 2 #define OP_WIMOVES 16 /* Number of pieces moved on */ #define Winitmoves option[OP_WIMOVES] /* white's first turn */ #define HI_WIMOVES 127 #define OP_BIMOVES 17 /* Number of pieces moved on */ #define Binitmoves option[OP_BIMOVES] /* black's first turn */ #define HI_BIMOVES 127 #define OP_WMOVES 18 /* Number of pieces moved on */ #define Whitemoves option[OP_WMOVES] /* white's later turns */ #define MO_PROGRESS 0 /* Move one more than before */ #define HI_WMOVES 127 #define OP_BMOVES 19 /* Number of pieces moved on */ #define Blackmoves option[OP_BMOVES] /* black's later turns */ #define HI_BMOVES 127 #define OP_THRUCHECK 20 /* Can king move thru check? */ #define Thrucheck option[OP_THRUCHECK] /* (relevant in multimove */ #define HI_THRUCHECK TRUE /* games only) */ #define OP_WHITEKING 21 /* Piece which can be checked*/ #define Whiteking option[OP_WHITEKING] /* (must be a unique piece) */ #define HI_WHITEKING PIECES #define OP_BLACKKING 22 /* Piece which can be checked*/ #define Blackking option[OP_BLACKKING] /* (must be a unique piece) */ #define HI_BLACKKING PIECES #define OP_MUSTTAKE 23 /* Are captures required? */ #define Musttake option[OP_MUSTTAKE] #define HI_MUSTTAKE TRUE #define OP_TABIYAT 24 /* Must pieces stay own side */ #define Tabiyat option[OP_TABIYAT] /* on first turn? */ #define HI_TABIYAT TRUE #define OPTIONS 25 /* Number of options defined */ /* King of color c */ #define Kingtype(c) ((c == WHITE) ? Whiteking : Blackking) #define Kingpiece(c) ((c == WHITE) ? Whiteking : -Blackking) /* Reasons for winning or losing or drawing or cancelling */ #define EV_NOTHING 0 /* Nothing happened */ #define EV_CHECKMATE 1 /* Checkmate */ #define EV_STALEMATE 2 /* Stalemate */ #define EV_FORCES 3 /* Player lost forces */ #define EV_AGREEMENT 4 /* Players agreed to result */ #define EV_FIFTYMOVES 5 /* Fifty tame moves */ #define EV_REPEATED 6 /* Three times repeated position */ #define EV_FORFIET 7 /* Player forfieted */ /* Maximum size of board - actual size is given by variabls Rows and Cols */ #define R_SIZE HI_ROWS + 1 #define C_SIZE HI_COLS + 1 /* Macros to find left, right, top and bottom of board */ #define lside(c) (((c)==BLACK) ? Cols : 0) #define rside(c) (((c)==WHITE) ? Cols : 0) #define bside(c) (((c)==BLACK) ? Rows : 0) #define tside(c) (((c)==WHITE) ? Rows : 0) /* Macro to decide if piece p is color c, or if p and c are same color (sign) */ /* #define coloris(p,c) ((p ^ c) & 0200) not used... */ /* A string of n blanks, n between 0 and BLANK_LEN */ #define BLANK_LEN 70 #define blanks(n) (blankstr+BLANK_LEN-(n)) /* Error Codes for bad moves */ #define E_OK 0000 /* no error */ #define E_MT 0001 /* move from empty square */ #define E_AF 0002 /* attack on friendly piece */ #define E_EQ 0003 /* source and destination square are equal */ #define E_SY 0004 /* Move syntax error */ #define E_MC 0005 /* Move into Check */ #define E_NC 0006 /* Pieces in not allowed to capture */ #define E_MM 0007 /* Check during multiple move */ #define E_CR 0010 /* A capture was required */ #define E_CC 0011 /* May not cross center on first move */ #define E_IL 0100 /* Illegal Move */ #define E_KI 0101 /* Illegal move of King */ #define E_QI 0102 /* Illegal move of Queen */ #define E_BI 0103 /* Illegal move of Bishop */ #define E_NI 0104 /* Illegal move of Knight */ #define E_RI 0105 /* Illegal move of Rook */ #define E_PI 0106 /* Illegal move of Pawn */ #define E_MI 0107 /* Illegal move of Minister */ #define E_EI 0110 /* Illegal move of Elephant */ #define E_DI 0111 /* Illegal move of Duke */ #define E_JI 0112 /* Illegal move of Jester */ #define E_HI 0113 /* Illegal move of Maharajah */ #define E_CP 0200 /* Illegal castling position */ #define E_CM 0201 /* Castled moved piece */ #define E_CT 0202 /* Castled through check */ #define E_MB 0300 /* Blocked move */ #define E_KB 0301 /* Blocked move of Kamikazi King */ #define E_QB 0302 /* Blocked move of Queen */ #define E_BB 0303 /* Blocked move of Bishop */ #define E_BR 0305 /* Blocked move of Rook */ #define E_BH 0313 /* Illegal move of Maharajah */ /* Lengths for game transcript file io buffer */ #define CB_LEN 160 /* Comment buffer length */ #define MB_LEN CB_LEN+28 /* Move buffer length */ /* Column positions of things inside game transcript files */ #define C_DAY 0 /* Day of the year that the line was entered */ #define C_CMD 6 /* Command letter (Move,Draw,Challenge,etc) */ #define C_MAT 7 /* Check, Stalemate or Mate */ #define C_MOV 8 /* Move made */ #define C_FLG 13 /* Is there a comment? */ #define C_COM 14 /* Comment text */ /* * Number of moves after which to apply the fifty move rule. This is set up * so it is easy to change to some small number for debugging. */ #ifndef MAXTAME #define MAXTAME 100 #endif /* System 3 and System 5 and everything else uses the signal library */ #define LSIGNAL /* 4.2bsd uses the sigvec library */ #ifdef U42BSD # define UBERK # define LSIGVEC # undef LSIGSYS # undef LSIGNAL #endif /* 4.1bsd uses the sigsys library */ #ifdef U41BSD # define UBERK # define LSIGSYS # undef LSIGVEC # undef LSIGNAL #endif