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