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