Next: , Previous: , Up: C API   [Contents][Index]


5.39 libsim

5.39.1 Overview

View lcov test coverage results on http://www.ufoot.org/liquidwar/v6/doc/coverage/src/lib/sim/index.html.

5.39.2 API

Function: void lw6sim_print (lw6sys_context_t * sys_context, lw6sim_results_t * results, FILE * f)

sys_context: global system context

results: data to print

f: file to print data to

Pretty prints results on standard output.

Return value: none.

Function: void lw6sim_results_zero (lw6sys_context_t * sys_context, lw6sim_results_t * results)

sys_context: global system context

results: out param, will be cleared

Fills the struct with zeroes.

Return value: none.

Function: int lw6sim_results_update_percents (lw6sys_context_t * sys_context, lw6sim_results_t * results)

sys_context: global system context

results: results set to work on (in/out param)

Updates the structure so that the percent members are up to date.

Return value: 1 on success, 0 on failure.

Function: int lw6sim_simulate (lw6sys_context_t * sys_context, int argc, const char * [] argv, lw6sim_results_t * results, int nb_teams, char * bot_backend)

sys_context: global system context

argc: argc as passed to main

argv: argv as passed to main

results: out param, results of the simulation

nb_teams: number of teams

bot_backend: bot backend to use

Runs a simulation of several battle/games on the default map using different team settings. Will test teams up to the given number, for instance if you give 3 as an argument, will run tests with teams 0, 1 and 2 (that’s to say a total of 3 teams).

Return value: 1 on success, 0 on failure.

Function: int lw6sim_simulate_basic (lw6sys_context_t * sys_context, int argc, const char * [] argv, lw6sim_results_t * results)

sys_context: global system context

argc: argc as passed to main

argv: argv as passed to main

results: out param, results of the simulation

Runs a simulation of several battle/games on the default map using different team settings. Will test the most common colors only, with the most popular bot.

Return value: 1 on success, 0 on failure.

Function: int lw6sim_simulate_full (lw6sys_context_t * sys_context, int argc, const char * [] argv, lw6sim_results_t * results)

sys_context: global system context

argc: argc as passed to main

argv: argv as passed to main

results: out param, results of the simulation

Runs a simulation of several battle/games on the default map using different team settings. Will test all colors, with the most popular bot.

Return value: 1 on success, 0 on failure.

Function: int lw6sim_test_register (lw6sys_context_t * sys_context, int mode)

sys_context: global system context

mode: test mode (bitmask)

Registers all tests for the libsim module.

Return value: 1 if test is successfull, 0 on error.

Function: int lw6sim_test_run (lw6sys_context_t * sys_context, int mode)

sys_context: global system context

mode: test mode (bitmask)

Runs the sim module test suite, testing most (if not all...) functions.

Return value: 1 if test is successfull, 0 on error.

Struct: lw6sim_results_s

Results for the game simulation, contains basic statistics about who won the games.

Member of lw6sim_results_s: nb_teams

Type: int

Definition: int lw6sim_results_s::nb_teams

Number of teams that were tested.

Member of lw6sim_results_s: absolute

Type: int

Definition: int lw6sim_results_s::absolute[LW6MAP_MAX_NB_TEAMS]

Absolute score. The unit is arbitrary and depends on the game type, the number of games. Well, it means nothing in itself, each team needs to be compared to the other ones.

Member of lw6sim_results_s: percent

Type: float

Definition: float lw6sim_results_s::percent[LW6MAP_MAX_NB_TEAMS]

Score as a percentage. This is based on several games played, the higher it is the stronger the team is.


Next: , Previous: , Up: C API   [Contents][Index]