play.h
Go to the documentation of this file.
1 
12 #ifndef EDAX_PLAY_H
13 #define EDAX_PLAY_H
14 
15 #include "board.h"
16 #include "book.h"
17 #include "search.h"
18 #include "move.h"
19 #include "util.h"
20 
22 #define PLAY_MESSAGE_MAX_LENGTH 4096
23 
25 typedef struct Play {
26  Board board[1];
31  int type;
32  int player;
34  Move game[80];
35  int i_game;
36  int n_game;
37  volatile PlayState state;
38  int level;
39  long long clock;
40  struct {
41  long long spent;
42  long long left;
43  long long extra;
44  } time[2];
45  struct {
46  Board real[80];
47  Board unique[80];
48  Move move[80];
49  int n_move;
50  int i_move;
51  } force;
52  struct {
53  Thread thread;
54  Lock lock;
55  Board board[1];
56  bool launched;
57  bool verbose;
58  } ponder[1];
60 } Play;
61 
62 /* functions */
63 bool play_is_game_over(Play*);
64 bool play_must_pass(Play *play);
65 void play_init(Play*, Book*);
66 void play_free(Play*);
67 void play_new(Play*);
68 void play_ggs_init(Play*, const char*);
69 bool play_load(Play*, const char*);
70 void play_save(Play*, const char*);
71 void play_auto_save(Play*);
72 void play_go(Play*, const bool);
73 void play_hint(Play*, int);
74 void play_hint_for_lib(Play*, int, HintList*); // add for libedax by lavox. 2018/1/17
75 void play_hint_prepare(Play*); // add for libedax by lavox. 2018/1/17
76 void play_hint_next(Play*, Hint*); // add for libedax by lavox. 2018/1/17
77 void play_stop(Play*);
78 void* play_ponder_run(void*);
79 void play_ponder(Play*);
80 void* play_ponder_loop(void*);
82 void play_update(Play*, Move*);
83 void play_pass(Play*);
84 void play_undo(Play*);
85 void play_redo(Play*);
86 void play_set_board(Play*, const char*);
87 void play_set_board_from_FEN(Play*, const char*);
88 void play_set_board_from_obj(Play*, const Board*, const int); // add for libedax by lavox. 2018/1/16
89 void play_game(Play*, const char*);
90 bool play_move(Play*, int);
91 bool play_user_move(Play*, const char*);
93 void play_analyze(Play*, int);
94 void play_book_analyze(Play*, int);
95 void play_learn(Play*);
96 void play_store(Play*);
97 void play_adjust_time(Play*, const int, const int);
98 void play_print(Play*, FILE*);
99 void play_force_init(Play*, const char*);
100 void play_force_update(Play*);
101 void play_force_restore(Play*);
102 bool play_force_go(Play*, Move*);
103 void play_symetry(Play*, const int);
104 const char* play_show_opening_name(Play*, const char *(*opening_get_name)(const Board*));
105 
106 #endif
107 
void play_symetry(Play *, const int)
Get the symetry of the actual position.
Definition: play.c:1365
Thread thread
Definition: play.h:53
bool verbose
Definition: play.h:57
void play_game(Play *, const char *)
Play a move sequence.
Definition: play.c:813
bool play_must_pass(Play *play)
Check if player must pass.
Definition: play.c:202
The opening book.
Definition: book.h:25
void play_force_update(Play *)
Update a forced line.
Definition: play.c:1292
void play_save(Play *, const char *)
Save a played game.
Definition: play.c:131
void play_redo(Play *)
Redo a move.
Definition: play.c:742
void play_stop_pondering(Play *)
Stop pondering.
Definition: play.c:696
void * play_ponder_run(void *)
do ponderation.
Definition: play.c:609
void play_init(Play *, Book *)
Initialization.
Definition: play.c:27
Definition: play.h:25
struct Play Play
PlayState
Definition: const.h:99
Board unique[80]
Definition: play.h:47
int i_move
Definition: play.h:50
Definition: move.h:20
int type
Definition: play.h:31
int initial_player
Definition: play.h:33
long long spent
Definition: play.h:41
int n_game
Definition: play.h:36
struct Play::@21 time[2]
void play_update(Play *, Move *)
Update the game.
Definition: play.c:174
struct Play::@23 ponder[1]
Definition: board.h:26
Move move[80]
Definition: play.h:48
void play_book_analyze(Play *, int)
Analyze a played game.
Definition: play.c:1087
void play_ponder(Play *)
Ponder.
Definition: play.c:676
int i_game
Definition: play.h:35
long long left
Definition: play.h:42
void play_hint_prepare(Play *)
prepare hint for libEdax
Definition: play.c:512
Definition: search.h:81
void play_adjust_time(Play *, const int, const int)
adjust time.
Definition: play.c:1158
struct Play::@22 force
void play_pass(Play *)
long long clock
Definition: play.h:39
void play_stop(Play *)
Stop thinking.
Definition: play.c:716
void play_set_board(Play *, const char *)
Set a new board.
Definition: play.c:757
void play_undo(Play *)
Undo a move.
Definition: play.c:726
int level
Definition: play.h:38
int player
Definition: play.h:32
char error_message[PLAY_MESSAGE_MAX_LENGTH]
Definition: play.h:59
Definition: search.h:95
bool play_is_game_over(Play *)
Check if game is over.
Definition: play.c:190
void play_hint(Play *, int)
Start thinking.
Definition: play.c:365
Definition: search.h:62
Miscellaneous utilities header.
long long extra
Definition: play.h:43
bool play_move(Play *, int)
Play a move.
Definition: play.c:836
Result result[1]
Definition: play.h:29
Definition: search.h:41
void play_set_board_from_FEN(Play *, const char *)
Set a new board.
Definition: play.c:775
bool play_force_go(Play *, Move *)
Play a forced move.
Definition: play.c:1331
Move game[80]
Definition: play.h:34
void play_hint_next(Play *, Hint *)
get next hint
Definition: play.c:536
Board board[1]
Definition: play.h:26
void play_set_board_from_obj(Play *, const Board *, const int)
Set a new board.
Definition: play.c:793
Board initial_board[1]
Definition: play.h:27
volatile PlayState state
Definition: play.h:37
void play_free(Play *)
Free resources.
Definition: play.c:52
void play_force_init(Play *, const char *)
Initialize a forced line.
Definition: play.c:1260
void play_hint_for_lib(Play *, int, HintList *)
hint for libEdax
Definition: play.c:439
void play_force_restore(Play *)
Restore a forced line.
Definition: play.c:1311
int n_move
Definition: play.h:49
void play_auto_save(Play *)
void play_print(Play *, FILE *)
Print the game state.
Definition: play.c:1172
void play_go(Play *, const bool)
Start thinking.
Definition: play.c:214
bool launched
Definition: play.h:56
Move * play_get_last_move(Play *)
Get the last played move.
Definition: play.c:874
const char * play_show_opening_name(Play *, const char *(*opening_get_name)(const Board *))
Print the opening name.
Definition: play.c:1385
void * play_ponder_loop(void *)
Search search[1]
Definition: play.h:28
#define PLAY_MESSAGE_MAX_LENGTH
Definition: play.h:22
Board real[80]
Definition: play.h:46
Lock lock
Definition: play.h:54
bool play_load(Play *, const char *)
Load a saved game.
Definition: play.c:84
void play_new(Play *)
Start a new game.
Definition: play.c:62
void play_store(Play *)
store the game into the opening book
Definition: play.c:1122
bool play_user_move(Play *, const char *)
Play a user move.
Definition: play.c:856
Book * book
Definition: play.h:30
void play_learn(Play *)
void play_ggs_init(Play *, const char *)
void play_analyze(Play *, int)
Analyze a played game.
Definition: play.c:980