Next: libsnd, Previous: libscm, 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 (lw6sim_results_t * results, FILE * f)

  results: data to print

  f: file to print data to

  Pretty prints results on standard output.

  Return value: none.

Function: void lw6sim_results_zero (lw6sim_results_t * results)

  results: out param, will be cleared

  Fills the struct with zeroes.

  Return value: none.

Function: int lw6sim_results_update_percents (lw6sim_results_t * results)

  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 (int argc, const char * [] argv, lw6sim_results_t * results, int nb_teams, char * bot_backend)

  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 (int argc, const char * [] argv, lw6sim_results_t * results)

  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 (int argc, const char * [] argv, lw6sim_results_t * results)

  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 (int mode)

  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 (int mode)

  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: libsnd, Previous: libscm, Up: C API [Contents][Index]