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