pattern.c: Introduce CAPTURE_COUNTSTONES_MAX
[pachi/t.git] / engine.h
blob809413293343c4d48ed2df19f66e3b010f5d23f7
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, char *enginearg);
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 /* Evaluate feasibility of player @color playing at all free moves. Will
22 * simulate each move from b->f[i] for time @ti, then set
23 * 1-max(opponent_win_likelihood) in vals[i]. */
24 typedef void (*engine_evaluate)(struct engine *e, struct board *b, struct time_info *ti, floating_t *vals, enum stone color);
25 /* One dead group per queued move (coord_t is (ab)used as group_t). */
26 typedef void (*engine_dead_group_list)(struct engine *e, struct board *b, struct move_queue *mq);
27 /* e->data and e will be free()d by caller afterwards. */
28 typedef void (*engine_done)(struct engine *e);
30 /* This is engine data structure. A new engine instance is spawned
31 * for each new game during the program lifetime. */
32 struct engine {
33 char *name;
34 char *comment;
36 /* If set, do not reset the engine state on clear_board. */
37 bool keep_on_clear;
39 engine_notify notify;
40 board_cprint printhook;
41 engine_notify_play notify_play;
42 engine_chat chat;
43 engine_undo undo;
44 engine_result result;
45 engine_genmove genmove;
46 engine_genmoves genmoves;
47 engine_evaluate evaluate;
48 engine_dead_group_list dead_group_list;
49 engine_done done;
50 void *data;
53 #endif