My Project
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
25typedef struct Play {
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];
48 Move move[80];
49 int n_move;
50 int i_move;
52 struct {
53 Thread thread;
54 Lock lock;
55 Board board[1];
56 bool launched;
57 bool verbose;
58 } ponder[1];
61
62/* functions */
64bool play_must_pass(Play *play);
65void play_init(Play*, Book*);
66void play_free(Play*);
67void play_new(Play*);
68void play_ggs_init(Play*, const char*);
69bool play_load(Play*, const char*);
70void play_save(Play*, const char*);
72void play_go(Play*, const bool);
73void play_hint(Play*, int);
74void play_hint_for_lib(Play*, int, HintList*); // add for libedax by lavox. 2018/1/17
75void play_get_bookmove(Play*, MoveList*); // add for libedax by lavox. 2018/5/26
76int play_get_bookmove_with_position(Play*, MoveList*, Position*); // add for libedax by lavox. 2020/2/24
77void play_hint_prepare(Play*, MoveList*); // add for libedax by lavox. 2018/1/17
78void play_hint_next(Play*, Hint*, const bool); // add for libedax by lavox. 2018/1/17
79void play_stop(Play*);
80void* play_ponder_run(void*);
81void play_ponder(Play*);
82void* play_ponder_loop(void*);
84void play_update(Play*, Move*);
86void play_undo(Play*);
87void play_redo(Play*);
88void play_set_board(Play*, const char*);
89void play_set_board_from_FEN(Play*, const char*);
90void play_set_board_from_obj(Play*, const Board*, const int); // add for libedax by lavox. 2018/1/16
91void play_game(Play*, const char*);
92bool play_move(Play*, int);
93bool play_user_move(Play*, const char*);
95void play_analyze(Play*, int);
96void play_book_analyze(Play*, int);
98void play_store(Play*);
99void play_adjust_time(Play*, const int, const int);
100void play_print(Play*, FILE*);
101void play_force_init(Play*, const char*);
104bool play_force_go(Play*, Move*);
105void play_symetry(Play*, const int);
106const char* play_show_opening_name(Play*, const char *(*opening_get_name)(const Board*));
107
108#endif
109
PlayState
Definition: const.h:99
bool play_must_pass(Play *play)
Check if player must pass.
Definition: play.c:202
void play_hint_next(Play *, Hint *, const bool)
get next hint
Definition: play.c:589
void * play_ponder_run(void *)
do ponderation.
Definition: play.c:662
void play_symetry(Play *, const int)
Get the symetry of the actual position.
Definition: play.c:1418
void play_ggs_init(Play *, const char *)
void play_auto_save(Play *)
void play_new(Play *)
Start a new game.
Definition: play.c:62
void play_go(Play *, const bool)
Start thinking.
Definition: play.c:214
void play_book_analyze(Play *, int)
Analyze a played game.
Definition: play.c:1140
#define PLAY_MESSAGE_MAX_LENGTH
Definition: play.h:22
void play_print(Play *, FILE *)
Print the game state.
Definition: play.c:1225
void * play_ponder_loop(void *)
void play_free(Play *)
Free resources.
Definition: play.c:52
void play_learn(Play *)
void play_update(Play *, Move *)
Update the game.
Definition: play.c:174
void play_stop(Play *)
Stop thinking.
Definition: play.c:769
bool play_load(Play *, const char *)
Load a saved game.
Definition: play.c:84
void play_ponder(Play *)
Ponder.
Definition: play.c:729
void play_analyze(Play *, int)
Analyze a played game.
Definition: play.c:1033
void play_redo(Play *)
Redo a move.
Definition: play.c:795
void play_force_update(Play *)
Update a forced line.
Definition: play.c:1345
void play_hint_for_lib(Play *, int, HintList *)
hint for libEdax
Definition: play.c:439
void play_set_board_from_obj(Play *, const Board *, const int)
Set a new board.
Definition: play.c:846
bool play_move(Play *, int)
Play a move.
Definition: play.c:889
void play_hint(Play *, int)
Start thinking.
Definition: play.c:365
void play_stop_pondering(Play *)
Stop pondering.
Definition: play.c:749
void play_get_bookmove(Play *, MoveList *)
get book move for libEdax
Definition: play.c:513
void play_store(Play *)
store the game into the opening book
Definition: play.c:1175
void play_hint_prepare(Play *, MoveList *)
prepare hint for libEdax
Definition: play.c:556
void play_set_board(Play *, const char *)
Set a new board.
Definition: play.c:810
bool play_is_game_over(Play *)
Check if game is over.
Definition: play.c:190
void play_game(Play *, const char *)
Play a move sequence.
Definition: play.c:866
void play_undo(Play *)
Undo a move.
Definition: play.c:779
void play_save(Play *, const char *)
Save a played game.
Definition: play.c:131
void play_set_board_from_FEN(Play *, const char *)
Set a new board.
Definition: play.c:828
void play_adjust_time(Play *, const int, const int)
adjust time.
Definition: play.c:1211
void play_pass(Play *)
int play_get_bookmove_with_position(Play *, MoveList *, Position *)
get book move for libEdax
Definition: play.c:535
bool play_user_move(Play *, const char *)
Play a user move.
Definition: play.c:909
void play_force_init(Play *, const char *)
Initialize a forced line.
Definition: play.c:1313
Move * play_get_last_move(Play *)
Get the last played move.
Definition: play.c:927
const char * play_show_opening_name(Play *, const char *(*opening_get_name)(const Board *))
Print the opening name.
Definition: play.c:1438
void play_init(Play *, Book *)
Initialization.
Definition: play.c:27
bool play_force_go(Play *, Move *)
Play a forced move.
Definition: play.c:1384
void play_force_restore(Play *)
Restore a forced line.
Definition: play.c:1364
Definition: board.h:26
The opening book.
Definition: book.h:25
Definition: search.h:81
Definition: search.h:62
Definition: move.h:29
Definition: move.h:20
Definition: play.h:25
int player
Definition: play.h:32
long long clock
Definition: play.h:39
bool verbose
Definition: play.h:57
Board board[1]
Definition: play.h:26
int n_move
Definition: play.h:49
long long spent
Definition: play.h:41
Move game[80]
Definition: play.h:34
Board unique[80]
Definition: play.h:47
Result result[1]
Definition: play.h:29
struct Play::@22 force
long long left
Definition: play.h:42
int initial_player
Definition: play.h:33
Board initial_board[1]
Definition: play.h:27
Thread thread
Definition: play.h:53
int level
Definition: play.h:38
bool launched
Definition: play.h:56
int n_game
Definition: play.h:36
struct Play::@21 time[2]
Move move[80]
Definition: play.h:48
Search search[1]
Definition: play.h:28
volatile PlayState state
Definition: play.h:37
struct Play::@23 ponder[1]
int type
Definition: play.h:31
char error_message[PLAY_MESSAGE_MAX_LENGTH]
Definition: play.h:59
Book * book
Definition: play.h:30
int i_game
Definition: play.h:35
Board real[80]
Definition: play.h:46
int i_move
Definition: play.h:50
Lock lock
Definition: play.h:54
long long extra
Definition: play.h:43
A position stored in the book.
Definition: book.h:77
Definition: search.h:41
Definition: search.h:95
Miscellaneous utilities header.