Check in polyglot-1.4w10UCIb15
[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 "util.h"\r
14 \r
15 // constants\r
16 \r
17 const int OptionNb = 256;\r
18 \r
19 // types\r
20 \r
21 struct option_t {\r
22     const char * name;\r
23     const char * value;\r
24     const char * type;\r
25     const char * max;\r
26     const char * min;\r
27     const char * var;\r
28 };\r
29 \r
30 struct uci_t {\r
31 \r
32    engine_t * engine;\r
33 \r
34    const char * name;\r
35    const char * author;\r
36 \r
37    int option_nb;\r
38    option_t option[OptionNb];\r
39 \r
40    bool ready;\r
41    int ready_nb;\r
42 \r
43    bool searching;\r
44    int pending_nb;\r
45 \r
46    board_t board[1];\r
47 \r
48    int best_move;\r
49    int ponder_move;\r
50 \r
51    int score;\r
52    int depth;\r
53    int sel_depth;\r
54    move_t pv[LineSize];\r
55 \r
56    int best_score;\r
57    int best_depth;\r
58    int best_sel_depth;\r
59    move_t best_pv[LineSize];\r
60 \r
61    sint64 node_nb;\r
62    double time;\r
63    double speed;\r
64    double cpu;\r
65    double hash;\r
66    move_t current_line[LineSize];\r
67 \r
68    int root_move;\r
69    int root_move_pos;\r
70    int root_move_nb;\r
71    bool multipv_mode;\r
72 };\r
73 \r
74 enum dummy_event_t {\r
75    EVENT_NONE  = 0,\r
76    EVENT_UCI   = 1 << 0,\r
77    EVENT_READY = 1 << 1,\r
78    EVENT_STOP  = 1 << 2,\r
79    EVENT_MOVE  = 1 << 3,\r
80    EVENT_PV    = 1 << 4,\r
81    EVENT_DEPTH = 1 << 5,\r
82    EVENT_DRAW  = 1 << 6,\r
83    EVENT_RESIGN= 1 << 7\r
84 };\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 bool uci_thread_option_exist(uci_t * uci);\r
100 extern int uci_get_option          (uci_t * uci, const char * name);\r
101 \r
102 extern bool uci_option_exist      (uci_t * uci, const char option[]);\r
103 extern void uci_send_option       (uci_t * uci, const char option[], const char format[], ...);\r
104 \r
105 extern void uci_close           (uci_t * uci);\r
106 \r
107 extern void uci_clear           (uci_t * uci);\r
108 \r
109 extern int  uci_parse           (uci_t * uci, const char string[]);\r
110 \r
111 void uci_set_option(uci_t * uci,\r
112                     const char * name,\r
113                     const char * value,\r
114                     const char * type,\r
115                     const char * max,\r
116                     const char * min,\r
117                     const char * var);\r
118 \r
119 #endif // !defined UCI_H\r
120 \r
121 // end of uci.h\r
122 \r