My Project
Functions | Variables
libedax.c File Reference

Edax api. More...

#include "cassio.h"
#include "event.h"
#include "histogram.h"
#include "options.h"
#include "opening.h"
#include "obftest.h"
#include "perft.h"
#include "play.h"
#include "search.h"
#include "util.h"
#include "ui.h"

Functions

void version (void)
 Print version & copyright. More...
 
DLL_API void libedax_initialize (int argc, char **argv)
 edax init function for library use. More...
 
DLL_API void libedax_terminate ()
 edax terminate function for library use. More...
 
static void libedax_observer (Result *result)
 default search oberver for libedax. More...
 
void ui_init_libedax (UI *ui)
 initialize libedax api. More...
 
void ui_free_libedax (UI *ui)
 free resources used by libedax api. More...
 
void auto_go ()
 auto go with regard to mode. More...
 
DLL_API void edax_init ()
 init command. More...
 
DLL_API void edax_new ()
 new command. More...
 
DLL_API void edax_load (const char *file)
 load command. More...
 
DLL_API void edax_save (const char *file)
 save command. More...
 
DLL_API void edax_undo ()
 undo command. More...
 
DLL_API void edax_redo ()
 redo command. More...
 
DLL_API void edax_mode (const int mode)
 mode command. More...
 
DLL_API void edax_setboard (const char *board)
 setboard command. More...
 
DLL_API void edax_setboard_from_obj (const Board *board, const int turn)
 setboard command with board object. More...
 
DLL_API void edax_vmirror ()
 vmirror command. More...
 
DLL_API void edax_hmirror ()
 hmirror command. More...
 
DLL_API void edax_rotate (const int angle)
 rotate command. More...
 
DLL_API void edax_symetry (const int sym)
 symetry command. More...
 
DLL_API void edax_play (char *moves)
 play command. More...
 
DLL_API void edax_force (char *moves)
 force command. More...
 
DLL_API void edax_bench (BenchResult *result, int n)
 bench (a serie of low level tests). command. More...
 
DLL_API void edax_bench_get_result (BenchResult *result)
 
DLL_API void edax_go ()
 go command. More...
 
DLL_API void edax_hint (const int n, HintList *hintlist)
 hint command. More...
 
DLL_API void edax_get_bookmove (MoveList *move_list)
 get book moves. More...
 
DLL_API int edax_get_bookmove_with_position (MoveList *move_list, Position *position)
 get book moves. More...
 
DLL_API int edax_get_bookmove_with_position_by_moves (const char *moves, MoveList *move_list, Position *position)
 get book moves. More...
 
DLL_API void edax_hint_prepare (MoveList *exclude_list)
 hint command. Call edax_hint_next after calling this function. More...
 
DLL_API void edax_hint_next (Hint *hint)
 hint command. Gets hint one by one. If there are no more hints, hint will be NOMOVE. Call edax_hint_prepare before calling this function. More...
 
DLL_API void edax_hint_next_no_multipv_depth (Hint *hint)
 hint command. Gets hint one by one. If there are no more hints, hint will be NOMOVE. Call edax_hint_prepare before calling this function. This command is for analyze use. More...
 
DLL_API void edax_stop ()
 stop command. More...
 
DLL_API void edax_version ()
 version command. More...
 
DLL_API int edax_move (const char *move)
 user move command. More...
 
DLL_API void edax_options_dump ()
 dump options. More...
 
DLL_API const char * edax_opening ()
 opening command. More...
 
DLL_API const char * edax_ouverture ()
 ouverture command. More...
 
void book_cmd_pre_process (UI *ui)
 pre-process of book command. More...
 
void book_cmd_post_process (UI *ui)
 post-process of book command. More...
 
DLL_API void edax_book_store ()
 book store command. More...
 
DLL_API void edax_book_on ()
 book on command. More...
 
DLL_API void edax_book_off ()
 book off command. More...
 
DLL_API void edax_book_randomness (const int randomness)
 book randomness command. More...
 
DLL_API void edax_book_depth (const int depth)
 book depth command. More...
 
DLL_API void edax_book_new (const int level, const int depth)
 book new command. More...
 
DLL_API void edax_book_load (const char *book_file)
 book load command. More...
 
DLL_API void edax_book_save (const char *book_file)
 book save command. More...
 
DLL_API void edax_book_import (const char *import_file)
 book import command. More...
 
DLL_API void edax_book_export (const char *export_file)
 book export command. More...
 
DLL_API void edax_book_merge (const char *book_file)
 book merge command. More...
 
DLL_API void edax_book_fix ()
 book fix command. More...
 
DLL_API void edax_book_negamax ()
 book negamax command. More...
 
DLL_API void edax_book_correct ()
 book correct command. More...
 
DLL_API void edax_book_prune ()
 book prune command. More...
 
DLL_API void edax_book_subtree ()
 book subtree command. More...
 
DLL_API void edax_book_stats_clean ()
 book stats clean command. More...
 
DLL_API void edax_book_show (Position *position)
 book show command. More...
 
DLL_API void edax_book_info (Book *book)
 book info command. More...
 
DLL_API void edax_book_count_bestpath (Board *board, Position *position)
 count the number of best paths in book. More...
 
DLL_API void edax_book_count_board_bestpath (Board *board, Position *position, const int p_lower, const int o_lower, const int turn)
 count the number of best paths in book. More...
 
DLL_API void edax_book_stop_count_bestpath ()
 stop counting the number of best paths in book. More...
 
DLL_API void edax_book_verbose (const int book_verbosity)
 book verbose command. More...
 
DLL_API void edax_book_add (const char *base_file)
 book add command. More...
 
DLL_API void edax_book_check (const char *base_file)
 book check command. More...
 
DLL_API void edax_book_extract (const char *base_file)
 book extract command. More...
 
DLL_API void edax_book_deviate (int relative_error, int absolute_error)
 book deviate command. More...
 
DLL_API void edax_book_enhance (int midgame_error, int endcut_error)
 book enhance command. More...
 
DLL_API void edax_book_fill (int fill_depth)
 book fill command. More...
 
DLL_API void edax_book_play ()
 book play command. More...
 
DLL_API void edax_book_deepen ()
 book deepen command. caution: Currently, this function does not work correctly. More...
 
DLL_API void edax_book_feed_hash ()
 book feed-hash command. More...
 
DLL_API void edax_book_add_board_pre_process ()
 book add board preprocess. More...
 
DLL_API void edax_book_add_board_post_process ()
 book add board postprocess. More...
 
DLL_API void edax_book_add_board (const Board *board)
 book add board. More...
 
DLL_API void edax_base_problem (const char *base_file, const int n_empties, const char *problem_file)
 base problem command. More...
 
DLL_API void edax_base_tofen (const char *base_file, const int n_empties, const char *problem_file)
 base tofen command. More...
 
DLL_API void edax_base_correct (const char *base_file, const int n_empties)
 base correct command. More...
 
DLL_API void edax_base_complete (const char *base_file)
 base complete command. More...
 
DLL_API void edax_base_convert (const char *base_file_from, const char *base_file_to)
 base convert command. More...
 
DLL_API void edax_base_unique (const char *base_file_from, const char *base_file_to)
 base unique command. More...
 
DLL_API void edax_set_option (const char *option_name, const char *val)
 set (option) command. More...
 
DLL_API char * edax_get_moves (char *str)
 get moves of the current game. More...
 
DLL_API int edax_is_game_over ()
 check if the current game is over. More...
 
DLL_API int edax_can_move ()
 check if the current player can move. More...
 
DLL_API void edax_get_last_move (Move *move)
 get last move. More...
 
DLL_API void edax_get_board (Board *board)
 get current board. More...
 
DLL_API int edax_get_current_player ()
 get current player. More...
 
DLL_API int edax_get_disc (const int color)
 get current number of discs. More...
 
DLL_API int edax_get_mobility_count (const int color)
 get current number of legal moves. More...
 
DLL_API void edax_play_print ()
 print play. More...
 
DLL_API void edax_enable_book_verbose ()
 enable book_verbose to get stdout by bprint. More...
 
DLL_API void edax_disable_book_verbose ()
 disable book_verbose not to get stdout by bprint. More...
 
DLL_API int edax_board_is_pass (const Board *board)
 Check if current player should pass. More...
 
DLL_API int edax_board_get_square_color (const Board *board, const int x)
 Get square color. More...
 

Variables

bool book_verbose
 
UIg_ui
 
BenchResultg_bench_result
 

Detailed Description

Edax api.

Date
2018
Author
lavox

Function Documentation

◆ auto_go()

void auto_go ( void  )

auto go with regard to mode.

◆ book_cmd_post_process()

void book_cmd_post_process ( UI ui)

post-process of book command.

Parameters
uiuser interface.

◆ book_cmd_pre_process()

void book_cmd_pre_process ( UI ui)

pre-process of book command.

Parameters
uiuser interface.

◆ edax_base_complete()

DLL_API void edax_base_complete ( const char *  base_file)

base complete command.

Parameters
base_filegame database file.

◆ edax_base_convert()

DLL_API void edax_base_convert ( const char *  base_file_from,
const char *  base_file_to 
)

base convert command.

Parameters
base_file_frominput game database file.
base_file_tooutput game database file.

◆ edax_base_correct()

DLL_API void edax_base_correct ( const char *  base_file,
const int  n_empties 
)

base correct command.

Parameters
base_filegame database file.
n_emptiesnumber of empties.

◆ edax_base_problem()

DLL_API void edax_base_problem ( const char *  base_file,
const int  n_empties,
const char *  problem_file 
)

base problem command.

Parameters
base_filegame database file.
n_emptiesnumber of empties.
problem_fileproblem_file to save.

◆ edax_base_tofen()

DLL_API void edax_base_tofen ( const char *  base_file,
const int  n_empties,
const char *  problem_file 
)

base tofen command.

Parameters
base_filegame database file.
n_emptiesnumber of empties.
problem_fileproblem_file to save.

◆ edax_base_unique()

DLL_API void edax_base_unique ( const char *  base_file_from,
const char *  base_file_to 
)

base unique command.

Parameters
base_file_frominput game database file.
base_file_tooutput game database file.

◆ edax_bench()

DLL_API void edax_bench ( BenchResult result,
int  n 
)

bench (a serie of low level tests). command.

◆ edax_bench_get_result()

DLL_API void edax_bench_get_result ( BenchResult result)

◆ edax_board_get_square_color()

DLL_API int edax_board_get_square_color ( const Board board,
const int  x 
)

Get square color.

Returns
0 = player, 1 = opponent, 2 = empty;

◆ edax_board_is_pass()

DLL_API int edax_board_is_pass ( const Board board)

Check if current player should pass.

◆ edax_book_add()

DLL_API void edax_book_add ( const char *  base_file)

book add command.

Parameters
base_filebase file to add.

◆ edax_book_add_board()

DLL_API void edax_book_add_board ( const Board board)

book add board.

Parameters
boardboard to add.

◆ edax_book_add_board_post_process()

DLL_API void edax_book_add_board_post_process ( void  )

book add board postprocess.

◆ edax_book_add_board_pre_process()

DLL_API void edax_book_add_board_pre_process ( void  )

book add board preprocess.

◆ edax_book_check()

DLL_API void edax_book_check ( const char *  base_file)

book check command.

Parameters
base_filebase file to check.

◆ edax_book_correct()

DLL_API void edax_book_correct ( void  )

book correct command.

◆ edax_book_count_bestpath()

DLL_API void edax_book_count_bestpath ( Board board,
Position position 
)

count the number of best paths in book.

Parameters
boardboard to count the number of best paths.
positionthe number of best paths(out parameter)

◆ edax_book_count_board_bestpath()

DLL_API void edax_book_count_board_bestpath ( Board board,
Position position,
const int  p_lower,
const int  o_lower,
const int  turn 
)

count the number of best paths in book.

Parameters
boardboard to count the number of best paths.
positionthe number of best paths(out parameter)
p_lowerlower limit for player (BESTPATH_BEST:best moves only)
o_lowerlower limit for opponent (BESTPATH_BEST:best moves only)
turnturn

◆ edax_book_deepen()

DLL_API void edax_book_deepen ( void  )

book deepen command. caution: Currently, this function does not work correctly.

◆ edax_book_depth()

DLL_API void edax_book_depth ( const int  depth)

book depth command.

Parameters
depthdepth.

◆ edax_book_deviate()

DLL_API void edax_book_deviate ( int  relative_error,
int  absolute_error 
)

book deviate command.

Parameters
relative_errorrelative error.
absolute_errorabsolute error.

◆ edax_book_enhance()

DLL_API void edax_book_enhance ( int  midgame_error,
int  endcut_error 
)

book enhance command.

Parameters
midgame_errormidgame error.
endcut_errorendcut error.

◆ edax_book_export()

DLL_API void edax_book_export ( const char *  export_file)

book export command.

Parameters
export_filefile name to export.

◆ edax_book_extract()

DLL_API void edax_book_extract ( const char *  base_file)

book extract command.

Parameters
base_filebase file to extract.

◆ edax_book_feed_hash()

DLL_API void edax_book_feed_hash ( void  )

book feed-hash command.

◆ edax_book_fill()

DLL_API void edax_book_fill ( int  fill_depth)

book fill command.

Parameters
fill_depthfill depth.

◆ edax_book_fix()

DLL_API void edax_book_fix ( void  )

book fix command.

◆ edax_book_import()

DLL_API void edax_book_import ( const char *  import_file)

book import command.

Parameters
import_filefile name to import.

◆ edax_book_info()

DLL_API void edax_book_info ( Book book)

book info command.

Parameters
bookbook information(out parameter).

◆ edax_book_load()

DLL_API void edax_book_load ( const char *  book_file)

book load command.

Parameters
book_filebook file name to load.

◆ edax_book_merge()

DLL_API void edax_book_merge ( const char *  book_file)

book merge command.

Parameters
book_filefile name to merge.

◆ edax_book_negamax()

DLL_API void edax_book_negamax ( void  )

book negamax command.

◆ edax_book_new()

DLL_API void edax_book_new ( const int  level,
const int  depth 
)

book new command.

Parameters
levellevel.
depthdepth.

◆ edax_book_off()

DLL_API void edax_book_off ( void  )

book off command.

◆ edax_book_on()

DLL_API void edax_book_on ( void  )

book on command.

◆ edax_book_play()

DLL_API void edax_book_play ( void  )

book play command.

◆ edax_book_prune()

DLL_API void edax_book_prune ( void  )

book prune command.

◆ edax_book_randomness()

DLL_API void edax_book_randomness ( const int  randomness)

book randomness command.

Parameters
randomnessrandomness.

◆ edax_book_save()

DLL_API void edax_book_save ( const char *  book_file)

book save command.

Parameters
book_filebook file name to save.

◆ edax_book_show()

DLL_API void edax_book_show ( Position position)

book show command.

Parameters
positionposition information(out parameter).

◆ edax_book_stats_clean()

DLL_API void edax_book_stats_clean ( void  )

book stats clean command.

◆ edax_book_stop_count_bestpath()

DLL_API void edax_book_stop_count_bestpath ( void  )

stop counting the number of best paths in book.

◆ edax_book_store()

DLL_API void edax_book_store ( void  )

book store command.

◆ edax_book_subtree()

DLL_API void edax_book_subtree ( void  )

book subtree command.

◆ edax_book_verbose()

DLL_API void edax_book_verbose ( const int  book_verbosity)

book verbose command.

Parameters
book_verbositybook verbosity.

◆ edax_can_move()

DLL_API int edax_can_move ( void  )

check if the current player can move.

Returns
1 if the current player can move, otherwise 0.

◆ edax_disable_book_verbose()

DLL_API void edax_disable_book_verbose ( void  )

disable book_verbose not to get stdout by bprint.

◆ edax_enable_book_verbose()

DLL_API void edax_enable_book_verbose ( void  )

enable book_verbose to get stdout by bprint.

◆ edax_force()

DLL_API void edax_force ( char *  moves)

force command.

Parameters
movesmoves.

◆ edax_get_board()

DLL_API void edax_get_board ( Board board)

get current board.

Parameters
boardcurrent board(out parameter).

◆ edax_get_bookmove()

DLL_API void edax_get_bookmove ( MoveList move_list)

get book moves.

Parameters
move_listresult (out parameter).

◆ edax_get_bookmove_with_position()

DLL_API int edax_get_bookmove_with_position ( MoveList move_list,
Position position 
)

get book moves.

Parameters
move_listresult (out parameter).
Returns
symetry. If -1, it means "no book" or "game over".

◆ edax_get_bookmove_with_position_by_moves()

DLL_API int edax_get_bookmove_with_position_by_moves ( const char *  moves,
MoveList move_list,
Position position 
)

get book moves.

Parameters
move_listresult (out parameter).
positionresult (out parameter).
Returns
symetry. If -1, it means "no book" or "game over".

◆ edax_get_current_player()

DLL_API int edax_get_current_player ( void  )

get current player.

Returns
current player(0:BLACK, 1:WHITE).

◆ edax_get_disc()

DLL_API int edax_get_disc ( const int  color)

get current number of discs.

Parameters
colorplayer's color(0:BLACK, 1:WHITE).
Returns
number of discs.

◆ edax_get_last_move()

DLL_API void edax_get_last_move ( Move move)

get last move.

Parameters
movelast move(out parameter).

◆ edax_get_mobility_count()

DLL_API int edax_get_mobility_count ( const int  color)

get current number of legal moves.

Parameters
colorplayer's color(0:BLACK, 1:WHITE).
Returns
number of legal moves.

◆ edax_get_moves()

DLL_API char * edax_get_moves ( char *  str)

get moves of the current game.

Parameters
strbuffer of length 160 + 1 or more (out parameter).
Returns
moves(equals to str. This is for Java, as Java String is immutable).

◆ edax_go()

DLL_API void edax_go ( void  )

go command.

◆ edax_hint()

DLL_API void edax_hint ( const int  n,
HintList hintlist 
)

hint command.

Parameters
nnumber of hints.
hintlistresult (out parameter).

◆ edax_hint_next()

DLL_API void edax_hint_next ( Hint hint)

hint command. Gets hint one by one. If there are no more hints, hint will be NOMOVE. Call edax_hint_prepare before calling this function.

Parameters
nnumber of hints.
hintlistresult (out parameter).

◆ edax_hint_next_no_multipv_depth()

DLL_API void edax_hint_next_no_multipv_depth ( Hint hint)

hint command. Gets hint one by one. If there are no more hints, hint will be NOMOVE. Call edax_hint_prepare before calling this function. This command is for analyze use.

Parameters
nnumber of hints.
hintlistresult (out parameter).

◆ edax_hint_prepare()

DLL_API void edax_hint_prepare ( MoveList exclude_list)

hint command. Call edax_hint_next after calling this function.

◆ edax_hmirror()

DLL_API void edax_hmirror ( void  )

hmirror command.

◆ edax_init()

DLL_API void edax_init ( void  )

init command.

◆ edax_is_game_over()

DLL_API int edax_is_game_over ( void  )

check if the current game is over.

Returns
1 if game is over, otherwise 0.

◆ edax_load()

DLL_API void edax_load ( const char *  file)

load command.

Parameters
filefile name to open

◆ edax_mode()

DLL_API void edax_mode ( const int  mode)

mode command.

Parameters
modemode to set

◆ edax_move()

DLL_API int edax_move ( const char *  move)

user move command.

Parameters
moveuser move.
Returns
1 if the move has been legally played, otherwise 0.

◆ edax_new()

DLL_API void edax_new ( void  )

new command.

◆ edax_opening()

DLL_API const char * edax_opening ( void  )

opening command.

Returns
opening name.

◆ edax_options_dump()

DLL_API void edax_options_dump ( void  )

dump options.

◆ edax_ouverture()

DLL_API const char * edax_ouverture ( void  )

ouverture command.

Returns
opening name in french.

◆ edax_play()

DLL_API void edax_play ( char *  moves)

play command.

Parameters
movesmoves.

◆ edax_play_print()

DLL_API void edax_play_print ( void  )

print play.

◆ edax_redo()

DLL_API void edax_redo ( void  )

redo command.

◆ edax_rotate()

DLL_API void edax_rotate ( const int  angle)

rotate command.

Parameters
angleangle for rotation

◆ edax_save()

DLL_API void edax_save ( const char *  file)

save command.

Parameters
filefile name to save

◆ edax_set_option()

DLL_API void edax_set_option ( const char *  option_name,
const char *  val 
)

set (option) command.

Parameters
option_namename of option.
valvalue to set.

◆ edax_setboard()

DLL_API void edax_setboard ( const char *  board)

setboard command.

Parameters
boardboard to set

◆ edax_setboard_from_obj()

DLL_API void edax_setboard_from_obj ( const Board board,
const int  turn 
)

setboard command with board object.

Parameters
boardboard to set
turnplayer to play

◆ edax_stop()

DLL_API void edax_stop ( void  )

stop command.

◆ edax_symetry()

DLL_API void edax_symetry ( const int  sym)

symetry command.

Parameters
symsymetry.

◆ edax_undo()

DLL_API void edax_undo ( void  )

undo command.

◆ edax_version()

DLL_API void edax_version ( void  )

version command.

◆ edax_vmirror()

DLL_API void edax_vmirror ( void  )

vmirror command.

◆ libedax_initialize()

DLL_API void libedax_initialize ( int  argc,
char **  argv 
)

edax init function for library use.

Parameters
argcNumber of arguments.
argvCommand line arguments.

◆ libedax_observer()

static void libedax_observer ( Result result)
static

default search oberver for libedax.

Parameters
resultSearch Result.

◆ libedax_terminate()

DLL_API void libedax_terminate ( void  )

edax terminate function for library use.

◆ ui_free_libedax()

void ui_free_libedax ( UI ui)

free resources used by libedax api.

Parameters
uiuser interface.

◆ ui_init_libedax()

void ui_init_libedax ( UI ui)

initialize libedax api.

Parameters
uiuser interface.

◆ version()

void version ( void  )

Print version & copyright.

Variable Documentation

◆ book_verbose

bool book_verbose
extern

◆ g_bench_result

BenchResult* g_bench_result

◆ g_ui

UI* g_ui