UCT local_tree_eval=total: Introduce
[pachi/nmclean.git] / engine.h
blob637303c775e3685f68ad93e296b99c99417e20ab
1 #ifndef PACHI_ENGINE_H
2 #define PACHI_ENGINE_H
4 #include "board.h"
5 #include "move.h"
6 #include "gtp.h"
8 struct move_queue;
10 typedef enum parse_code (*engine_notify)(struct engine *e, struct board *b, int id, char *cmd, char *args, char **reply);
11 typedef char *(*engine_notify_play)(struct engine *e, struct board *b, struct move *m);
12 typedef char *(*engine_undo)(struct engine *e, struct board *b);
13 typedef char *(*engine_result)(struct engine *e, struct board *b);
14 typedef char *(*engine_chat)(struct engine *e, struct board *b, char *cmd);
15 /* Generate a move. If pass_all_alive is true, <pass> shall be generated only
16 * if all stones on the board can be considered alive, without regard to "dead"
17 * considered stones. */
18 typedef coord_t *(*engine_genmove)(struct engine *e, struct board *b, struct time_info *ti, enum stone color, bool pass_all_alive);
19 typedef char *(*engine_genmoves)(struct engine *e, struct board *b, struct time_info *ti, enum stone color,
20 char *args, bool pass_all_alive, void **stats_buf, int *stats_size);
21 /* One dead group per queued move (coord_t is (ab)used as group_t). */
22 typedef void (*engine_dead_group_list)(struct engine *e, struct board *b, struct move_queue *mq);
23 /* e->data and e will be free()d by caller afterwards. */
24 typedef void (*engine_done)(struct engine *e);
26 /* This is engine data structure. A new engine instance is spawned
27 * for each new game during the program lifetime. */
28 struct engine {
29 char *name;
30 char *comment;
32 /* If set, do not reset the engine state on clear_board. */
33 bool keep_on_clear;
35 engine_notify notify;
36 board_cprint printhook;
37 engine_notify_play notify_play;
38 engine_chat chat;
39 engine_undo undo;
40 engine_result result;
41 engine_genmove genmove;
42 engine_genmoves genmoves;
43 engine_dead_group_list dead_group_list;
44 engine_done done;
45 void *data;
48 #endif