Freeciv-3.2
Loading...
Searching...
No Matches
Functions
difficulty.h File Reference

Go to the source code of this file.

Functions

void set_ai_level_directer (struct player *pplayer, enum ai_level level)
 
charai_level_help (const char *cmdname)
 
bool ai_fuzzy (const struct player *pplayer, bool normal_decision)
 

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, TRUE)) { 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 && TRUE) { action } –dwp

Definition at line 339 of file difficulty.c.

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 239 of file difficulty.c.

◆ set_ai_level_directer()

void set_ai_level_directer ( struct player pplayer,
enum ai_level  level 
)