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