Decrement node_sizes when freeing a node.
[pachi.git] / engine.h
blob8097d5045844722e1b7641ee7f571fa272f606da
1 #ifndef ZZGO_ENGINE_H
2 #define ZZGO_ENGINE_H
4 #include "board.h"
5 #include "move.h"
7 /* Used to signal the main loop that the engine structures need to be reset
8 * (for fresh board). */
9 extern bool engine_reset;
11 struct engine;
12 struct move_queue;
14 typedef char *(*engine_notify_play)(struct engine *e, struct board *b, struct move *m);
15 typedef char *(*engine_chat)(struct engine *e, struct board *b, char *cmd);
16 typedef coord_t *(*engine_genmove)(struct engine *e, struct board *b, enum stone color);
17 /* One dead group per queued move (coord_t is (ab)used as group_t). */
18 typedef void (*engine_dead_group_list)(struct engine *e, struct board *b, struct move_queue *mq);
19 /* e->data and e will be free()d by caller afterwards. */
20 typedef void (*engine_done)(struct engine *e);
22 /* This is engine data structure. A new engine instance is spawned
23 * for each new game during the program lifetime. */
24 struct engine {
25 char *name;
26 char *comment;
28 /* If set, do not reset the engine state on clear_board. */
29 bool keep_on_clear;
31 board_cprint printhook;
32 engine_notify_play notify_play;
33 engine_chat chat;
34 engine_genmove genmove;
35 engine_dead_group_list dead_group_list;
36 engine_done done;
37 void *data;
40 #endif