version 1.4.58b
[polyglot.git] / uci.h
1 \r
2 // uci.h\r
3 \r
4 #ifndef UCI_H\r
5 #define UCI_H\r
6 \r
7 // includes\r
8 \r
9 #include "board.h"\r
10 #include "engine.h"\r
11 #include "line.h"\r
12 #include "move.h"\r
13 #include "option.h"\r
14 #include "util.h"\r
15 \r
16 // macros\r
17 \r
18 // I need to make a uniform string type.\r
19 \r
20 #define UciStringSize 4096\r
21 #define MultiPVStackSize 256\r
22 \r
23 // types\r
24 \r
25 typedef struct {\r
26   \r
27   engine_t * engine;\r
28   \r
29   const char * name;\r
30   const char * author;\r
31   \r
32   option_list_t option[1];\r
33   \r
34   bool ready;\r
35   int ready_nb;\r
36   \r
37   bool searching;\r
38   int pending_nb;\r
39   \r
40   board_t board[1];\r
41   \r
42   int best_move;\r
43   int ponder_move;\r
44   \r
45   int score;\r
46   int depth;\r
47   int sel_depth;\r
48   move_t pv[LineSize];\r
49   \r
50   int best_score;\r
51   int best_depth;\r
52   int best_sel_depth;\r
53   move_t best_pv[LineSize];\r
54   \r
55   sint64 node_nb;\r
56   double time;\r
57   double speed;\r
58   double cpu;\r
59   double hash;\r
60   move_t current_line[LineSize];\r
61   \r
62   int root_move;\r
63   int root_move_pos;\r
64   int root_move_nb;\r
65   bool multipv_mode;\r
66   int multipvSP;\r
67   int multipvScore[MultiPVStackSize];\r
68   move_t multipvMove[MultiPVStackSize];\r
69   char info[UciStringSize];\r
70 } uci_t;\r
71 \r
72 typedef enum {\r
73    EVENT_NONE         = 0,\r
74    EVENT_UCI          = 1 << 0,\r
75    EVENT_READY        = 1 << 1,\r
76    EVENT_STOP         = 1 << 2,\r
77    EVENT_MOVE         = 1 << 3,\r
78    EVENT_PV           = 1 << 4,\r
79    EVENT_DEPTH        = 1 << 5,\r
80    EVENT_DRAW         = 1 << 6,\r
81    EVENT_RESIGN       = 1 << 7,\r
82    EVENT_ILLEGAL_MOVE = 1 << 8,\r
83    EVENT_INFO         = 1 << 9\r
84 } dummy_event_t;\r
85 \r
86 // variables\r
87 \r
88 extern uci_t Uci[1];\r
89 \r
90 // functions\r
91 \r
92 extern void uci_open              (uci_t * uci, engine_t * engine);\r
93 extern void uci_send_isready      (uci_t * uci);\r
94 extern void uci_send_isready_sync (uci_t * uci);\r
95 extern void uci_send_stop         (uci_t * uci);\r
96 extern void uci_send_stop_sync    (uci_t * uci);\r
97 extern void uci_send_ucinewgame   (uci_t * uci);\r
98 extern void uci_set_threads       (uci_t * uci, int n);\r
99 extern const char * uci_thread_option(uci_t * uci);\r
100 extern bool uci_send_option       (uci_t * uci, const char option[], const char format[], ...);\r
101 extern void uci_close             (uci_t * uci);\r
102 extern void uci_clear             (uci_t * uci);\r
103 extern int  uci_parse             (uci_t * uci, const char string[]);\r
104 \r
105 #endif // !defined UCI_H\r
106 \r
107 // end of uci.h\r
108 \r