My Project
Classes | Macros | Typedefs | Functions
play.h File Reference

Edax play control - header file. More...

#include "board.h"
#include "book.h"
#include "search.h"
#include "move.h"
#include "util.h"

Go to the source code of this file.

Classes

struct  Play
 

Macros

#define PLAY_MESSAGE_MAX_LENGTH   4096
 

Typedefs

typedef struct Play Play
 

Functions

bool play_is_game_over (Play *)
 Check if game is over. More...
 
bool play_must_pass (Play *play)
 Check if player must pass. More...
 
void play_init (Play *, Book *)
 Initialization. More...
 
void play_free (Play *)
 Free resources. More...
 
void play_new (Play *)
 Start a new game. More...
 
void play_ggs_init (Play *, const char *)
 
bool play_load (Play *, const char *)
 Load a saved game. More...
 
void play_save (Play *, const char *)
 Save a played game. More...
 
void play_auto_save (Play *)
 
void play_go (Play *, const bool)
 Start thinking. More...
 
void play_hint (Play *, int)
 Start thinking. More...
 
void play_hint_for_lib (Play *, int, HintList *)
 hint for libEdax More...
 
void play_get_bookmove (Play *, MoveList *)
 get book move for libEdax More...
 
int play_get_bookmove_with_position (Play *, MoveList *, Position *)
 get book move for libEdax More...
 
void play_hint_prepare (Play *, MoveList *)
 prepare hint for libEdax More...
 
void play_hint_next (Play *, Hint *, const bool)
 get next hint More...
 
void play_stop (Play *)
 Stop thinking. More...
 
void * play_ponder_run (void *)
 do ponderation. More...
 
void play_ponder (Play *)
 Ponder. More...
 
void * play_ponder_loop (void *)
 
void play_stop_pondering (Play *)
 Stop pondering. More...
 
void play_update (Play *, Move *)
 Update the game. More...
 
void play_pass (Play *)
 
void play_undo (Play *)
 Undo a move. More...
 
void play_redo (Play *)
 Redo a move. More...
 
void play_set_board (Play *, const char *)
 Set a new board. More...
 
void play_set_board_from_FEN (Play *, const char *)
 Set a new board. More...
 
void play_set_board_from_obj (Play *, const Board *, const int)
 Set a new board. More...
 
void play_game (Play *, const char *)
 Play a move sequence. More...
 
bool play_move (Play *, int)
 Play a move. More...
 
bool play_user_move (Play *, const char *)
 Play a user move. More...
 
Moveplay_get_last_move (Play *)
 Get the last played move. More...
 
void play_analyze (Play *, int)
 Analyze a played game. More...
 
void play_book_analyze (Play *, int)
 Analyze a played game. More...
 
void play_learn (Play *)
 
void play_store (Play *)
 store the game into the opening book More...
 
void play_adjust_time (Play *, const int, const int)
 adjust time. More...
 
void play_print (Play *, FILE *)
 Print the game state. More...
 
void play_force_init (Play *, const char *)
 Initialize a forced line. More...
 
void play_force_update (Play *)
 Update a forced line. More...
 
void play_force_restore (Play *)
 Restore a forced line. More...
 
bool play_force_go (Play *, Move *)
 Play a forced move. More...
 
void play_symetry (Play *, const int)
 Get the symetry of the actual position. More...
 
const char * play_show_opening_name (Play *, const char *(*opening_get_name)(const Board *))
 Print the opening name. More...
 

Detailed Description

Edax play control - header file.

Date
1998 - 2017
Author
Richard Delorme
Version
4.4

Macro Definition Documentation

◆ PLAY_MESSAGE_MAX_LENGTH

#define PLAY_MESSAGE_MAX_LENGTH   4096

error message max length

Typedef Documentation

◆ Play

typedef struct Play Play

play structure

Function Documentation

◆ play_adjust_time()

void play_adjust_time ( Play play,
const int  left,
const int  extra 
)

adjust time.

Set remaining time to play from a server (GGS) or a GUI (Quarry, ...).

Parameters
playPlay.
leftTime left.
extraExtra time.

◆ play_analyze()

void play_analyze ( Play play,
int  n 
)

Analyze a played game.

Parameters
playPlay.
nnumber of moves to analyze.

◆ play_auto_save()

void play_auto_save ( Play )

◆ play_book_analyze()

void play_book_analyze ( Play play,
int  n 
)

Analyze a played game.

Parameters
playPlay.
nnumber of moves to analyze.

◆ play_force_go()

bool play_force_go ( Play play,
Move move 
)

Play a forced move.

Check if the actual board is in the forced line, and play the next forced move.

Parameters
playPlay.
moveOutput move.
Returns
'true' if a forced move have been found.

◆ play_force_init()

void play_force_init ( Play play,
const char *  string 
)

Initialize a forced line.

Parameters
playPlay.
stringA string with a sequence of moves.

◆ play_force_restore()

void play_force_restore ( Play play)

Restore a forced line.

Check if the actual board is in the forced line, and restore the forced line accordingly.

Parameters
playPlay.

◆ play_force_update()

void play_force_update ( Play play)

Update a forced line.

Check if the actual board is in the forced line, and update the forced line accordingly.

Parameters
playPlay.

◆ play_free()

void play_free ( Play play)

Free resources.

Parameters
playPlay.

◆ play_game()

void play_game ( Play play,
const char *  string 
)

Play a move sequence.

Parameters
playPlay.
stringmove sequence.

◆ play_get_bookmove()

void play_get_bookmove ( Play play,
MoveList book_moves 
)

get book move for libEdax

Parameters
playPlay
book_movesresult(out parameter)

◆ play_get_bookmove_with_position()

int play_get_bookmove_with_position ( Play play,
MoveList book_moves,
Position position 
)

get book move for libEdax

Parameters
playPlay
book_movesresult(out parameter)
positionposition(out parameter)

◆ play_get_last_move()

Move * play_get_last_move ( Play play)

Get the last played move.

Parameters
playPlay.
Returns
last played move.

◆ play_ggs_init()

void play_ggs_init ( Play ,
const char *   
)

◆ play_go()

void play_go ( Play play,
const bool  update 
)

Start thinking.

Parameters
playPlay.
updateFlag to tell if edax should update or no its game.

◆ play_hint()

void play_hint ( Play play,
int  n 
)

Start thinking.

Evaluate first best moves of the position.

Parameters
playPlay.
nNumber of (best) moves to evaluate.

◆ play_hint_for_lib()

void play_hint_for_lib ( Play play,
int  n,
HintList hintlist 
)

hint for libEdax

Evaluate first best moves of the position.

Parameters
playPlay.
nNumber of (best) moves to evaluate.
hintlistresult (out parameter)

◆ play_hint_next()

void play_hint_next ( Play play,
Hint hint,
bool  multiPvDepthMax 
)

get next hint

Evaluate first best moves of the position among rest moves.

Parameters
playPlay.
hintresult (out parameter)

◆ play_hint_prepare()

void play_hint_prepare ( Play play,
MoveList exclude_list 
)

prepare hint for libEdax

Parameters
playPlay.

◆ play_init()

void play_init ( Play play,
Book book 
)

Initialization.

Parameters
playPlay.
bookOpening book.

◆ play_is_game_over()

bool play_is_game_over ( Play play)

Check if game is over.

Parameters
playPlay.
Returns
true if game is over.

◆ play_learn()

void play_learn ( Play )

◆ play_load()

bool play_load ( Play play,
const char *  file 
)

Load a saved game.

Parameters
playPlay.
fileFile name of the game.
Returns
true if game is successfuly loaded.

◆ play_move()

bool play_move ( Play play,
int  x 
)

Play a move.

Parameters
playPlay.
xCoordinate played.
Returns
true if the move has been legally played.

◆ play_must_pass()

bool play_must_pass ( Play play)

Check if player must pass.

Parameters
playPlay.
Returns
true if player must pass.

◆ play_new()

void play_new ( Play play)

Start a new game.

Parameters
playPlay.

◆ play_pass()

void play_pass ( Play )

◆ play_ponder()

void play_ponder ( Play play)

Ponder.

Think during opponent time. Activate the thread suspended in play_ponder_loop.

Parameters
playPlay.

◆ play_ponder_loop()

void * play_ponder_loop ( void *  )

◆ play_ponder_run()

void * play_ponder_run ( void *  v)

do ponderation.

Ponderation (thinking during opponent time) is done within a thread. The thread is launched at startup and immediately suspended, thanks to condition_wait. When edax is required to ponder, the thread is activated by a condition_signal, and the search start. To stop the ponderation, just stop the search and wait for the lock to be release.

Parameters
vthe play.
Returns
NULL (unused).

◆ play_print()

void play_print ( Play play,
FILE *  f 
)

Print the game state.

Print the game state: board, time, played move, etc.

Parameters
playPlay.
fOutput stream.

◆ play_redo()

void play_redo ( Play play)

Redo a move.

Parameters
playPlay.

◆ play_save()

void play_save ( Play play,
const char *  file 
)

Save a played game.

Parameters
playPlay.
fileFile name of the game.

◆ play_set_board()

void play_set_board ( Play play,
const char *  board 
)

Set a new board.

Parameters
playPlay.
boardA new board.

◆ play_set_board_from_FEN()

void play_set_board_from_FEN ( Play play,
const char *  board 
)

Set a new board.

Parameters
playPlay.
boardA new board.

◆ play_set_board_from_obj()

void play_set_board_from_obj ( Play play,
const Board board,
const int  turn 
)

Set a new board.

Parameters
playPlay.
boardA new board.
turnplayer to play
Author
lavox
Date
2018

◆ play_show_opening_name()

const char * play_show_opening_name ( Play play,
const char *(*)(const Board *)  opening_get_name 
)

Print the opening name.

◆ play_stop()

void play_stop ( Play play)

Stop thinking.

Parameters
playPlay.

◆ play_stop_pondering()

void play_stop_pondering ( Play play)

Stop pondering.

If edax is pondering, stop the search, and wait that the pondering thread is suspended.

Parameters
playPlay.

◆ play_store()

void play_store ( Play play)

store the game into the opening book

Parameters
playPlay.

◆ play_symetry()

void play_symetry ( Play play,
const int  sym 
)

Get the symetry of the actual position.

Parameters
playPlay.
symSymetry.

◆ play_undo()

void play_undo ( Play play)

Undo a move.

Parameters
playPlay.

◆ play_update()

void play_update ( Play play,
Move move 
)

Update the game.

Parameters
playPlay.
moveMove.

◆ play_user_move()

bool play_user_move ( Play play,
const char *  string 
)

Play a user move.

Parameters
playPlay.
stringMove as a string.
Returns
true if the move has been legally played.