Module binbo_server

Behaviours: gen_server.

Data Types

all_legal_moves_ret()

all_legal_moves_ret() = binbo_game:all_legal_moves_ret()

bb_game()

bb_game() = binbo_position:bb_game()

engine_path()

engine_path() = binbo_uci_connection:engine_path()

fen()

fen() = binbo_game:game_fen()

from()

from() = {pid(), reference()}

game_draw_ret()

game_draw_ret() = ok | {error, binbo_game:gameover_status_error()}

game_move_ret()

game_move_ret() = {ok, game_status()} | {error, binbo_game:move_error()}

game_state_ret()

game_state_ret() = undefined | bb_game()

game_status()

game_status() = binbo_game:game_status()

game_status_ret()

game_status_ret() = binbo_game:status_ret()

get_fen_ret()

get_fen_ret() = binbo_game:get_fen_ret()

init_uci_game_error()

init_uci_game_error() = {uci_connection_failed, term()}

load_pgn_file_ret()

load_pgn_file_ret() = {ok, game_status()} | {error, any()}

load_pgn_ret()

load_pgn_ret() = {ok, game_status()} | {error, binbo_game:load_pgn_error()}

new_game_ret()

new_game_ret() = {ok, game_status()} | {error, binbo_game:init_error()}

new_uci_game_ret()

new_uci_game_ret() = {ok, game_status()} | {error, init_uci_game_error()}

onterminate_callback()

onterminate_callback() = fun((pid(), Reason::term(), Game::game_state_ret(), Arg::term()) -> term())

server_opts()

server_opts() = #{idle_timeout => timeout(), onterminate => undefined | {onterminate_callback(), Arg::term()}}

set_game_winner_ret()

set_game_winner_ret() = ok | {error, binbo_game:gameover_status_error()}

sq_move()

sq_move() = binbo_move:sq_move()

state()

state() = #state{game = undefined | bb_game(), idle_timestamp = undefined | integer(), server_opts = server_opts(), uci_sockinfo = undefined | binbo_uci_connection:socket_info(), uci_from = undefined | from(), uci_wait_prefix = undefined | uci_wait_prefix(), uci_wait_prefix_size = undefined | uci_wait_prefix_size(), uci_wait_prefix_handler = undefined | uci_wait_prefix_handler(), uci_handler = uci_handler()}

stop_ret()

stop_ret() = ok | {error, {not_pid, term()}}

uci_bestmove_ret()

uci_bestmove_ret() = {ok, binary()} | {error, term()}

uci_cmd_spec()

uci_cmd_spec() = iodata() | binbo_uci_protocol:command_spec() | {set_position, fen()} | sync_position

uci_game_opts()

uci_game_opts() = #{engine_path := engine_path(), fen => fen()}

uci_handler()

uci_handler() = undefined | default | fun((binary()) -> term())

uci_play_ret()

uci_play_ret() = {ok, game_status(), sq_move()} | {error, term()}

uci_wait_prefix()

uci_wait_prefix() = binary()

uci_wait_prefix_handler()

uci_wait_prefix_handler() = fun((Message::binary(), uci_wait_prefix(), uci_wait_prefix_size()) -> reply_ok | {reply, term()} | skip)

uci_wait_prefix_size()

uci_wait_prefix_size() = pos_integer()

Function Index

all_legal_moves/2
code_change/3
game_draw/2
game_index_move/4
game_move/2
game_san_move/2
game_state/1
game_status/1
get_fen/1
get_pieces_list/2
get_server_options/1
handle_call/3
handle_cast/2
handle_info/2
init/1
load_pgn/2
load_pgn_file/2
new_game/2
new_uci_game/2
set_game_state/2
set_game_winner/3
set_server_options/2
set_uci_handler/2
side_to_move/1
start_link/1
stop/1
terminate/2
uci_bestmove/2
uci_command_call/2
uci_command_cast/2
uci_mode/1
uci_play/2
uci_play/3
uci_set_position/2
uci_sync_position/1

Function Details

all_legal_moves/2

all_legal_moves(Pid::pid(), MoveType::int | bin | str) -> all_legal_moves_ret()

code_change/3

code_change(OldVsn::term(), State::state(), Extra::term()) -> {ok, state()}

game_draw/2

game_draw(Pid::pid(), Reason::term()) -> game_draw_ret()

game_index_move/4

game_index_move(Pid::pid(), FromIdx::binbo_board:square_index(), ToIdx::binbo_board:square_index(), PromoType::q | r | b | n) -> game_move_ret()

game_move/2

game_move(Pid::pid(), Move::sq_move()) -> game_move_ret()

game_san_move/2

game_san_move(Pid::pid(), Move::sq_move()) -> game_move_ret()

game_state/1

game_state(Pid::pid()) -> game_state_ret()

game_status/1

game_status(Pid::pid()) -> game_status_ret()

get_fen/1

get_fen(Pid::pid()) -> get_fen_ret()

get_pieces_list/2

get_pieces_list(Pid::pid(), SquareType::index | notation) -> {ok, [binbo_position:sq_piece_tuple()]} | {error, term()}

get_server_options/1

get_server_options(Pid::pid()) -> {ok, server_opts()}

handle_call/3

handle_call(Msg::term(), From::from(), State::state()) -> {reply, term(), state(), timeout()} | {noreply, state(), timeout()}

handle_cast/2

handle_cast(Msg::term(), State::state()) -> {noreply, state(), timeout()} | {stop, normal, state()}

handle_info/2

handle_info(Msg::term(), State::state()) -> {noreply, state(), timeout()} | {stop, Reason::term(), state()}

init/1

init(ServerOpts::server_opts()) -> {ok, state(), timeout()} | {stop, {error, term()}}

load_pgn/2

load_pgn(Pid::pid(), Pgn::binbo_pgn:pgn()) -> load_pgn_ret()

load_pgn_file/2

load_pgn_file(Pid::pid(), Filename::binbo_game:filename()) -> load_pgn_file_ret()

new_game/2

new_game(Pid::pid(), Fen::fen()) -> new_game_ret()

new_uci_game/2

new_uci_game(Pid::pid(), Opts::uci_game_opts()) -> new_uci_game_ret()

set_game_state/2

set_game_state(Pid::pid(), Game::term()) -> game_status_ret()

set_game_winner/3

set_game_winner(Pid::pid(), Winner::binbo_game:winner(), Reason::term()) -> set_game_winner_ret()

set_server_options/2

set_server_options(Pid::pid(), Opts::server_opts()) -> ok | {error, term()}

set_uci_handler/2

set_uci_handler(Pid::pid(), Handler::uci_handler()) -> ok

side_to_move/1

side_to_move(Pid::pid()) -> binbo_game:side_to_move_ret()

start_link/1

start_link(ServerOpts::server_opts()) -> {ok, pid()}

stop/1

stop(Pid::pid()) -> stop_ret()

terminate/2

terminate(Reason::term(), State::state()) -> ok

uci_bestmove/2

uci_bestmove(Pid::pid(), Opts::binbo_uci_protocol:bestmove_opts()) -> uci_bestmove_ret()

uci_command_call/2

uci_command_call(Pid::pid(), Command::uci_cmd_spec()) -> ok | {ok, term()} | {error, term()}

uci_command_cast/2

uci_command_cast(Pid::pid(), Command::iodata()) -> ok

uci_mode/1

uci_mode(Pid::pid()) -> ok | {error, term()}

uci_play/2

uci_play(Pid::pid(), BestMoveOpts::binbo_uci_protocol:bestmove_opts()) -> uci_play_ret()

uci_play/3

uci_play(Pid::pid(), BestMoveOpts::binbo_uci_protocol:bestmove_opts(), Move::sq_move()) -> uci_play_ret()

uci_set_position/2

uci_set_position(Pid::pid(), Fen::fen()) -> {ok, game_status()} | {error, term()}

uci_sync_position/1

uci_sync_position(Pid::pid()) -> ok | {error, term()}


Generated by EDoc