version 1.4w10UCIb22
[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 // constants\r
17 \r
18 const int OptionNb = 256;\r
19 \r
20 struct uci_t {\r
21 \r
22    engine_t * engine;\r
23 \r
24    const char * name;\r
25    const char * author;\r
26 \r
27    int option_nb;\r
28    option_t option[OptionNb];\r
29 \r
30    bool ready;\r
31    int ready_nb;\r
32 \r
33    bool searching;\r
34    int pending_nb;\r
35 \r
36    board_t board[1];\r
37 \r
38    int best_move;\r
39    int ponder_move;\r
40 \r
41    int score;\r
42    int depth;\r
43    int sel_depth;\r
44    move_t pv[LineSize];\r
45 \r
46    int best_score;\r
47    int best_depth;\r
48    int best_sel_depth;\r
49    move_t best_pv[LineSize];\r
50 \r
51    sint64 node_nb;\r
52    double time;\r
53    double speed;\r
54    double cpu;\r
55    double hash;\r
56    move_t current_line[LineSize];\r
57 \r
58    int root_move;\r
59    int root_move_pos;\r
60    int root_move_nb;\r
61    bool multipv_mode;\r
62 };\r
63 \r
64 enum dummy_event_t {\r
65    EVENT_NONE  = 0,\r
66    EVENT_UCI   = 1 << 0,\r
67    EVENT_READY = 1 << 1,\r
68    EVENT_STOP  = 1 << 2,\r
69    EVENT_MOVE  = 1 << 3,\r
70    EVENT_PV    = 1 << 4,\r
71    EVENT_DEPTH = 1 << 5,\r
72    EVENT_DRAW  = 1 << 6,\r
73    EVENT_RESIGN= 1 << 7\r
74 };\r
75 \r
76 // variables\r
77 \r
78 extern uci_t Uci[1];\r
79 \r
80 // functions\r
81 \r
82 extern void uci_open              (uci_t * uci, engine_t * engine);\r
83 extern void uci_send_isready      (uci_t * uci);\r
84 extern void uci_send_isready_sync (uci_t * uci);\r
85 extern void uci_send_stop         (uci_t * uci);\r
86 extern void uci_send_stop_sync    (uci_t * uci);\r
87 extern void uci_send_ucinewgame   (uci_t * uci);\r
88 extern void uci_set_threads       (uci_t * uci, int n);\r
89 extern bool uci_thread_option_exist(uci_t * uci);\r
90 extern const char * uci_thread_option(uci_t * uci);\r
91 extern int uci_get_option          (uci_t * uci, const char * name);\r
92 \r
93 extern bool uci_option_exist      (uci_t * uci, const char option[]);\r
94 extern void uci_send_option       (uci_t * uci, const char option[], const char format[], ...);\r
95 \r
96 extern void uci_close           (uci_t * uci);\r
97 \r
98 extern void uci_clear           (uci_t * uci);\r
99 \r
100 extern int  uci_parse           (uci_t * uci, const char string[]);\r
101 \r
102 void uci_set_option(uci_t * uci,\r
103                     const char * name,\r
104                     const char * default_,\r
105                     const char * type,\r
106                     const char * max,\r
107                     const char * min,\r
108                     int var_nb,\r
109                     const char * var[]);\r
110 \r
111 #endif // !defined UCI_H\r
112 \r
113 // end of uci.h\r
114 \r