Distributed engine: support the kgs-rules command.
[pachi.git] / engine.h
blobd99ccd55f497a1dc56bb11cdf236f4b25e812a51
1 #ifndef ZZGO_ENGINE_H
2 #define ZZGO_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_chat)(struct engine *e, struct board *b, char *cmd);
13 /* Generate a move. If pass_all_alive is true, <pass> shall be generated only
14 * if all stones on the board can be considered alive, without regard to "dead"
15 * considered stones. */
16 typedef coord_t *(*engine_genmove)(struct engine *e, struct board *b, struct time_info *ti, enum stone color, bool pass_all_alive);
17 typedef char *(*engine_genmoves)(struct engine *e, struct board *b, struct time_info *ti, enum stone color, char *args, bool pass_all_alive);
18 /* One dead group per queued move (coord_t is (ab)used as group_t). */
19 typedef void (*engine_dead_group_list)(struct engine *e, struct board *b, struct move_queue *mq);
20 /* e->data and e will be free()d by caller afterwards. */
21 typedef void (*engine_done)(struct engine *e);
23 /* This is engine data structure. A new engine instance is spawned
24 * for each new game during the program lifetime. */
25 struct engine {
26 char *name;
27 char *comment;
29 /* If set, do not reset the engine state on clear_board. */
30 bool keep_on_clear;
32 engine_notify notify;
33 board_cprint printhook;
34 engine_notify_play notify_play;
35 engine_chat chat;
36 engine_genmove genmove;
37 engine_genmoves genmoves;
38 engine_dead_group_list dead_group_list;
39 engine_done done;
40 void *data;
43 #endif