Next: mod-brute, Previous: libliquidwar6, Up: C API [Contents][Index]
View lcov test coverage results on http://www.ufoot.org/liquidwar/v6/doc/coverage/src/lib/bot/index.html.
sys_context: global system context
backend: backend to use
seed: parameters required to build bot (game state, among other things)
Initializes a bot object. Must be performed before any other call. The seed is absolutely required, for a bot really needs to know what map/context it’s working on, including at creation time
Return value: 1 on success, 0 on failure.
sys_context: global system context
backend: unitialize a bot backend
Closes a bot, but does not free all ressources.
sys_context: global system context
backend: bot to work on
x: next x position (out param)
y: next y position (out param)
Queries the bot for its next move, this is actually the one interesting function in the whole bot API.
Return value: 1 on success, 0 on failure.
sys_context: global system context
backend: bot to represent
Gives a human readable representation of bot
Return value: dynamically allocated string.
sys_context: global system context
argc: argc, as passed to main
argv: argv, as passed to main
List available bot backends. The hash contains pairs with id and name for each backend. The id is the technical key you can use to load the backend, the name is something more readable you can display in an interface. The backend objects themselves are not instanciated by this (in fact, they are, but released on the fly) you need to load and initialize them afterwards.
Return value: hash containing id/name pairs.
sys_context: global system context
argc: argc, as passed to main
argv: argv, as passed to main
name: string containing bot key, typically got from lw6bot_get_backends
Creates a bot backend, this is just about loading the dynamic library if needed, and/or check bot engine is available, and connect to it. It does not perform initialization.
Return value: bot backend.
sys_context: global system context
backend: bot backend to destroy
Frees the ressources associated to a bot, which must have been properly uninitialized before.
Return value: none.
sys_context: global system context
mode: test mode (bitmask)
Registers all tests for the libbot module.
Return value: 1 if test is successfull, 0 on error.
sys_context: global system context
mode: test mode (bitmask)
Runs the bot
module test suite, testing most (if not all...)
functions.
Return value: 1 if test is successfull, 0 on error.
The bot backend is the first argument passed to any bot function, it contains reference to all the functions which can be used as well as a pointer on associated data. In OO, this would just be an object, with members and methods, using polymorphism through opaque pointers.
Type: lw6dyn_dl_handle_t *
Definition: lw6dyn_dl_handle_t* lw6bot_backend_s::dl_handle
Handle on dynamic library (if it makes sense).
Type: void *
Definition: void* lw6bot_backend_s::bot_context
Bot specific data, what is behind this pointer really depends on the bot engine.
Type: int
Definition: int lw6bot_backend_s::argc
The argc value passed to main.
Type: const char **
Definition: const char** lw6bot_backend_s::argv
The argv value passed to main.
Type: u_int32_t
Definition: u_int32_t lw6bot_backend_s::id
The id of the object, this is non-zero and unique within one run session, incremented at each object creation.
Type: lw6bot_seed_t
Definition: lw6bot_seed_t lw6bot_backend_s::seed
Parameters passed at initialization.
Type: void *(*
Definition: void*(* lw6bot_backend_s::init)(lw6sys_context_t *sys_context, int argc, const char *argv[], lw6bot_data_t *data)
Pointer on lw6bot_init callback code.
Type: void(*
Definition: void(* lw6bot_backend_s::quit)(lw6sys_context_t *sys_context, void *bot_context)
Pointer on lw6bot_context callback code.
Type: int(*
Definition: int(* lw6bot_backend_s::next_move)(lw6sys_context_t *sys_context, void *bot_context, int *x, int *y, lw6bot_data_t *data)
Pointer on lw6bot_next_move callback code.
Type: char *(*
Definition: char*(* lw6bot_backend_s::repr)(lw6sys_context_t *sys_context, void *bot_context, u_int32_t id)
Pointer on lw6bot_repr callback code.
Data used by a bot, those are essentially stable data passed as an argument plus changing data, that is, the game state.
Type: const lw6ker_game_state_t *
Definition: const lw6ker_game_state_t* lw6bot_data_s::game_state
Game state the bot will have to base its reflexion upon. This not need be always the same game state, the pointer might change, but it should always refer to the same logical game, that is, at least, same struct.
Type: lw6bot_param_t
Definition: lw6bot_param_t lw6bot_data_s::param
Constant parameters passed to the bot at creation.
Parameters usable by a bot engine. Those are the stable, fixed parameters passed at bot creation, they don’t change during the bot life.
Type: float
Definition: float lw6bot_param_s::speed
Speed of the bot, this is a value between 0.0f and 1.0f, 1 means normal speed, 0 is as slow as possible. Values over 1 will make the bot act/move faster than usual.
Type: int
Definition: int lw6bot_param_s::iq
IQ is supposed to reflect the cleverness of the bot. The default is 100 (this value is basically a percentage), 0 means just so stupid, and a high value, for instance 200, means very clever.
Type: u_int16_t
Definition: u_int16_t lw6bot_param_s::cursor_id
The cursor ID, which is a 16-bit non-null integer.
Parameters passed at bot creation, the only use for this is to simplify the protoype of the init function.
Type: const lw6ker_game_state_t *
Definition: const lw6ker_game_state_t* lw6bot_seed_s::game_state
Game state, that is, the level used, the fighters on it, the other cursors positions, and so on.
Type: lw6pil_pilot_t *
Definition: lw6pil_pilot_t* lw6bot_seed_s::pilot
This can be NULL, it’s a pilot object which can be used in some case, when, for instance, in dirty read mode, we want to read the level on the fly without syncing.
Type: int
Definition: int lw6bot_seed_s::dirty_read
The dirty read mode (between 0 and 2).
Type: lw6bot_param_t
Definition: lw6bot_param_t lw6bot_seed_s::param
Parameters given to the bot at creation.
Next: mod-brute, Previous: libliquidwar6, Up: C API [Contents][Index]