00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #if !defined(__BELOFTE_H__)
00030 #define __BELOFTE_H__
00031
00032 #include <ctype.h>
00033 #include <signal.h>
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036 #include <string.h>
00037
00038
00039 #include <time.h>
00040
00041
00042
00043 #if defined(__i386) && !defined(__LITTLE_ENDIAN__)
00044 #define __LITTLE_ENDIAN__ 1
00045 #endif
00046
00047 #if defined(_MSC_VER) && !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
00048 #define __LITTLE_ENDIAN__ 1
00049 #endif
00050
00051 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
00052 #error Do not know the endianess of this architecture
00053 #endif
00054
00055
00056
00057 #define MYNAME "Belofte"
00058 #define MYVERSION "0.2.8"
00059
00060 #define BOOKNAME "belofte-" MYVERSION ".book"
00061 #define PGNNAME "belofte-" MYVERSION ".pgn"
00062 #define LOGNAME "belofte-" MYVERSION ".log"
00063
00064 #define MAX_DATANAME_LENGTH 256
00065 #define MAX_FEN_LENGTH 128
00066 #define MAX_GAME_LENGTH 256
00067 #define MAX_MOVES_PER_POSITION 200
00068
00069
00070 #define MAX_MOVE_LENGTH 8
00071
00072
00073
00074 enum tBoolean { myFALSE = 0, myTRUE };
00075 enum tFillMoves { NO_FILLMOVES = 0, FILLMOVES };
00076 enum tColour { COLOUR_WHITE = 0, COLOUR_BLACK };
00077
00078 typedef int t_field;
00079 typedef int t_flag;
00080 typedef enum tColour t_colour;
00081 typedef int t_ply;
00082 typedef unsigned char byte;
00083 typedef unsigned short int posid;
00084 typedef enum tBoolean t_boolean;
00085 typedef float t_score;
00086 typedef float t_depth;
00087
00088
00089
00090 void board_setup(char *szFen);
00091 void board_print(void);
00092 int board_applymove(const char *szCoordMove);
00093 int board_unapplymove(void);
00094
00095 void cmd_constructor(char *szCommand, char *szArg);
00096 void cmd_constructor2(void);
00097 void cmd_new(char *szCommand, char *szArg);
00098 void cmd_go(char * szCommand, char * szArg);
00099 void cmd_sd(char * szCommand, char * szArg);
00100 void cmd_force(char * szCommand, char * szArg);
00101
00102 int cmd_readcommand(void);
00103 int cmd_peek(void);
00104 int cmd_readline(char * szBuffer, void *pFile, const size_t nSize);
00105 int file_readline(char * szBuffer, FILE *pFile, const size_t nSize);
00106
00107 void cmd_snd(const char *szMessage);
00108 void cmd_snd_info(const char *szMessage);
00109 void cmd_snd_move(const char *szMove);
00110 void cmd_snd_thinking(const int nPly, const t_score fEval, const char *szThinking);
00111
00112
00113
00114 enum {
00115 A1=0, B1, C1, D1, E1, F1, G1, H1 ,
00116 A2, B2, C2, D2, E2, F2, G2, H2 ,
00117 A3, B3, C3, D3, E3, F3, G3, H3 ,
00118 A4, B4, C4, D4, E4, F4, G4, H4 ,
00119 A5, B5, C5, D5, E5, F5, G5, H5 ,
00120 A6, B6, C6, D6, E6, F6, G6, H6 ,
00121 A7, B7, C7, D7, E7, F7, G7, H7 ,
00122 A8, B8, C8, D8, E8, F8, G8, H8
00123 } ;
00124
00125
00126
00127 #define MOVERESULT_OK 0
00128 #define MOVERESULT_NIL -1
00129 #define MOVERESULT_ERROR -99
00130
00131
00132
00133 #if !defined(min)
00134 #define min(a,b) ((a)<(b)?(a):(b))
00135 #endif
00136
00137 #if !defined(max)
00138 #define max(a,b) ((a)>(b)?(a):(b))
00139 #endif
00140
00141
00142
00143 #endif // def __YVESCHESS_