Freeciv21
Develop your civilization from humble roots to a global empire
difficulty.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void set_ai_level_directer (struct player *pplayer, enum ai_level level)
 Set an AI level and related quantities, with no feedback. More...
 
char * ai_level_help (const char *cmdname)
 Helper function for skill level command help. More...
 
bool ai_fuzzy (const struct player *pplayer, bool normal_decision)
 Return the value normal_decision (a boolean), except if the AI is fuzzy, then sometimes flip the value. More...
 

Function Documentation

◆ ai_fuzzy()

bool ai_fuzzy ( const struct player pplayer,
bool  normal_decision 
)

Return the value normal_decision (a boolean), except if the AI is fuzzy, then sometimes flip the value.

The intention of this is that instead of if (condition) { action } you can use if (ai_fuzzy(pplayer, condition)) { action } to sometimes flip a decision, to simulate an AI with some confusion, indecisiveness, forgetfulness etc. In practice its often safer to use if (condition && ai_fuzzy(pplayer,1)) { action } for an action which only makes sense if condition holds, but which a fuzzy AI can safely "forget". Note that for a non-fuzzy AI, or for a human player being helped by the AI (eg, autosettlers), you can ignore the "ai_fuzzy(pplayer," part, and read the previous example as: if (condition && 1) { action } –dwp

Definition at line 318 of file difficulty.cpp.

Referenced by dai_spend_gold(), find_something_to_kill(), is_my_turn(), look_for_charge(), and military_advisor_choose_build().

◆ ai_level_help()

char* ai_level_help ( const char *  cmdname)

Helper function for skill level command help.

'cmdname' is a server command name. Caller must free returned string.

Definition at line 225 of file difficulty.cpp.

◆ set_ai_level_directer()

void set_ai_level_directer ( struct player pplayer,
enum ai_level  level 
)

Set an AI level and related quantities, with no feedback.

Definition at line 36 of file difficulty.cpp.

Referenced by aifill(), create_animals(), create_barbarian_player(), player_set_to_ai_mode(), set_ai_level(), set_ai_level_direct(), and sg_load_player_main().