Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

aiunit.h File Reference

Unit and Unit Type Analysis and Status Function for AIs. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int could_see (int u)
 Could u see?

int can_be_on (int u, Side *side, int x, int y, int *p_without=NULL)
 Can u on a given side be on a given cell?

int can_be_on_known (int u, Side *side, int x, int y, int *p_without=NULL)
 Can u on a given side be on a given known cell?

int could_be_occupant_of (int u, int u2)
 Could u be an occupant of u2?

int could_be_occupant (int u)
 Could u be an occupant of any utypes?

int can_be_in (int u2, Side *side, UnitView *uvtspt)
 Can u2 on the given side be an occupant of the given uview?

int longest_economic_input (int u, int u2, int m)
 Longest direct economic input for a material from u2 to u.

int longest_economic_input (int u, int u2)
 Longest direct economic input from u2 to u.

int longest_economic_input (int u)
 Longest direct economic input from any utype to u.

void productivity_on_known (int *p_mtypes, int u, Side *side, int x, int y)
 Materials productivity on given known cell for given utype and side.

int can_survive_on_known (int u, Side *side, int x, int y, int *p_without=NULL)
 Can u on a given side survive on a given known cell?

int can_survive_on_known (Unit *survivor, int x, int y, int *p_without=NULL)
 Can a given unit survive a given known cell?

int can_refuel (Unit *supplier, Unit *demander, int m)
 Can a given unit refuel another given unit with a given fuel?

int can_create_completed_unit (Unit *acpsrc, Unit *creator, int u2)
 Can a given unit complete an unit of a given type at creation?

int can_construct_any (int u, Side *side)
 Can an utype on a given side construct >= 1 utypes?

int can_construct (Unit *acpsrc, Unit *constructor, int u2)
 Can a given unit construct an unit of a given type?

int can_construct_any (Unit *acpsrc, Unit *constructor)
 Can a given unit construct >= 1 utypes?

int can_repair_any (Unit *actor, Unit *repairer)
 Can given actor-repairer pair repair any utype?

int fire_damage_mean (int u, int u2)
 Mean fire damage that u does to u2.

int attack_damage_mean (int u, int u2)
 Mean attack damage that u does to u2.

int detonate_0dist_damage_mean (int u, int u2)
 Mean detonate damage that u does to u2 in same cell.

int detonate_ranged_damage_mean (int u, int u2)
 Mean detonate damage that u does to u2 at range.

int detonate_damage_mean (int u, int u2)
 Mean detonate damage that u does to u2.

int n_detonations_available (int u)
 Number of detonations available to u before expiring.

int could_counterattack (int u, int u2)
 Could u counterattack u2?

int could_countercapture (int u, int u2, Side *side)
 Could u countercapture u2 on a given side?

int could_prevent_capture_of (int u, int u2)
 Could u prevent capture of u2?

int could_prevent_capture_by (int u, int u2)
 Could u prevent capture by u2?

int could_damage_by_fire (int u, int u2)
 Could u damage u2 by firing?

int could_damage_by_attacks (int u, int u2)
 Could u damage u2 by attacks?

int could_destroy_by_fire (int u, int u2)
 Could u destroy u2 by firing?

int can_destroy_by_fire (Unit *actor, Unit *destroyer, int u)
 Can a given unit destroy a given utype by firing?

int can_destroy_any_by_fire (Unit *actor, Unit *destroyer)
 Can a given unit destroy >= 1 enemy utypes by firing?

int could_destroy_by_attacks (int u, int u2)
 Could u destroy u2 by attacks?

int can_destroy_by_attacks (Unit *actor, Unit *destroyer, int u)
 Can a given unit destroy a given utype by attacks?

int can_destroy_any_by_attacks (Unit *actor, Unit *destroyer)
 Can a given unit destroy >= 1 enemy utypes by attacks?

int could_damage_by_combat (int u, int u2)
 Could u damage u2 by combat?

int can_destroy_any_by_combat (Unit *acpsrc, Unit *destroyer)
 Can a given unit destroy >= 1 enemy utypes through combat?

int could_damage_by_detonations (int u, int u2)
 Could u damage u2 through detonations?

int could_destroy_by_detonations (int u, int u2)
 Could u destroy u2 through detonations?

int can_destroy_any_by_detonations (int u, Side *side)
 Can an utype on a given side destroy >= 1 enemy utypes through detonations?

int can_destroy_any_by_detonations (Unit *acpsrc, Unit *exploder)
 Can a given unit destroy >= 1 enemy utypes through detonations?

int could_damage (int u, int u2)
 Could u damage u2 by any means?

int could_damage_any (int u)
 Could u damage >= 1 enemy utypes by any means?

int can_destroy_any (Unit *acpsrc, Unit *destroyer)
 Can a given unit destroy >= 1 enemy utypes in any way?

int can_capture_by_fire (Unit *actor, Unit *captor, int u)
 Can a given unit capture a given utype by fire?

int can_capture_any (Unit *actor, Unit *captor)
 Can a given unit capture >= 1 enemy utypes in any way?

int can_countercapture_any (Unit *actor, Unit *countercaptor)
 Can a given unit countercapture >= 1 enemy utypes?

int can_prevent_capture_by_any (Unit *actor, Unit *anticaptor)
 Can a given unit prevent capture by >= 1 enemy utypes?

int could_defeat_by_fire (int u, int u2, Side *side)
 Could u defeat u2 by fire?

int can_defeat_by_fire (Unit *actor, Unit *firer, int u)
 Can a given unit defeat a given utype by fire?

int could_defeat_by_attacks (int u, int u2, Side *side)
 Could u defeat u2 by attacks?

int can_defeat_by_attacks (Unit *actor, Unit *attacker, int u)
 Can a given unit defeat a given utype with attacks?

int could_defeat_by_counterattacks (int u, int u2, Side *side)
 Could u defeat u2 by counterattacks?

int can_defeat_by_counterattacks (Unit *actor, Unit *counterattacker, int u)
 Can a given unit defeat a given utype with counterattacks?

int can_defeat_any_by_counterattacks (Unit *actor, Unit *counterattacker)
 Can a given unit defeat >= 1 enemy utypes by counterattacks?

int could_overwatch_against (int u, int u2, Side *side)
 Could u overwatch against u2?

int could_overwatch_against_and_defeat (int u, int u2)
 Could u overwatch against and defeat u2?

int can_overwatch_against_and_defeat (Unit *actor, Unit *overwatcher, int u)
 Can a given unit overwatch against and defeat a given utype?

int can_overwatch_against_and_defeat_any (Unit *actor, Unit *overwatcher)
 Can a given unit provide defeating overwatch against >= 1 enemy utypes?

int could_defend_against (int u, int u2, Side *side)
 Could u defend against u2 in any way?

int could_defend_against_any (int u)
 Could u defend against >= 1 enemy utypes in any way?

int can_defend_against_any (Unit *actor, Unit *defender)
 Can a given unit defend against >= 1 enemy utypes in any way?

int could_explore (int u)
 Could u explore?

int can_explore (Unit *actor, Unit *explorer)
 Can a given unit explore?

int can_construct_explorers (Unit *actor, Unit *constructor)
 Can a given unit construct explorers?

int could_colonize (int u)
 Could u colonize?

int can_colonize (int u, Side *side)
 Can a given utype on a given side colonize?

int can_colonize (Unit *actor, Unit *colonizer)
 Can a given unit colonize?

int can_construct_colonizers (Unit *actor, Unit *constructor)
 Can a given unit construct any colonizers?

int can_construct_offenders (Unit *actor, Unit *constructor)
 Can a given unit construct any offensive units?

int can_construct_defenders (Unit *actor, Unit *constructor)
 Can a given unit construct any defensive units?


Variables

int * cv__longest_economic_inputs
 Cache of longest direct economic inputs.


Detailed Description

Unit and Unit Type Analysis and Status Function for AIs.

Part of the AI API, Level 1.

Provides useful functions that an AI implementation may use to analyze and to learn the status of units and unit types.

The functions in this file provide information regarding units and unit types that is not directly available from the kernel functions, but is useful for decision-making.

There are various kinds of functions in this file. 'can_*' functions test an unit's inclusive-or side's current state to see if a given type of action or meta-action can be performed. 'could_*' functions disregard current state, and ask hypothetical questions based on type. These functions can be regarded as lower level than the 'can_*' functions.

Note:
Nothing in this file should ever be required to implement an AI; everything here is optional.
Todo:
Import most of the functions in 'aiutil.h' into this file.

Make use of caching, where applicable.


Function Documentation

int attack_damage_mean int  u,
int  u2
 

Mean attack damage that u does to u2.

int can_be_in int  u2,
Side side,
UnitView uvtspt
 

Can u2 on the given side be an occupant of the given uview?

int can_be_on int  u,
Side side,
int  x,
int  y,
int *  p_without = NULL
 

Can u on a given side be on a given cell?

int can_be_on_known int  u,
Side side,
int  x,
int  y,
int *  p_without = NULL
 

Can u on a given side be on a given known cell?

int can_capture_any Unit actor,
Unit captor
 

Can a given unit capture >= 1 enemy utypes in any way?

int can_capture_by_fire Unit actor,
Unit captor,
int  u
 

Can a given unit capture a given utype by fire?

int can_colonize Unit actor,
Unit colonizer
 

Can a given unit colonize?

int can_colonize int  u,
Side side
 

Can a given utype on a given side colonize?

int can_construct Unit acpsrc,
Unit constructor,
int  u2
 

Can a given unit construct an unit of a given type?

int can_construct_any Unit acpsrc,
Unit constructor
 

Can a given unit construct >= 1 utypes?

int can_construct_any int  u,
Side side
 

Can an utype on a given side construct >= 1 utypes?

int can_construct_colonizers Unit actor,
Unit constructor
 

Can a given unit construct any colonizers?

int can_construct_defenders Unit actor,
Unit constructor
 

Can a given unit construct any defensive units?

int can_construct_explorers Unit actor,
Unit constructor
 

Can a given unit construct explorers?

int can_construct_offenders Unit actor,
Unit constructor
 

Can a given unit construct any offensive units?

int can_countercapture_any Unit actor,
Unit countercaptor
 

Can a given unit countercapture >= 1 enemy utypes?

int can_create_completed_unit Unit acpsrc,
Unit creator,
int  u2
 

Can a given unit complete an unit of a given type at creation?

int can_defeat_any_by_counterattacks Unit actor,
Unit counterattacker
 

Can a given unit defeat >= 1 enemy utypes by counterattacks?

int can_defeat_by_attacks Unit actor,
Unit attacker,
int  u
 

Can a given unit defeat a given utype with attacks?

int can_defeat_by_counterattacks Unit actor,
Unit counterattacker,
int  u
 

Can a given unit defeat a given utype with counterattacks?

int can_defeat_by_fire Unit actor,
Unit firer,
int  u
 

Can a given unit defeat a given utype by fire?

int can_defend_against_any Unit actor,
Unit defender
 

Can a given unit defend against >= 1 enemy utypes in any way?

Todo:
Support counterfire.

int can_destroy_any Unit acpsrc,
Unit destroyer
 

Can a given unit destroy >= 1 enemy utypes in any way?

int can_destroy_any_by_attacks Unit actor,
Unit destroyer
 

Can a given unit destroy >= 1 enemy utypes by attacks?

int can_destroy_any_by_combat Unit acpsrc,
Unit destroyer
 

Can a given unit destroy >= 1 enemy utypes through combat?

int can_destroy_any_by_detonations Unit acpsrc,
Unit exploder
 

Can a given unit destroy >= 1 enemy utypes through detonations?

int can_destroy_any_by_detonations int  u,
Side side
 

Can an utype on a given side destroy >= 1 enemy utypes through detonations?

int can_destroy_any_by_fire Unit actor,
Unit destroyer
 

Can a given unit destroy >= 1 enemy utypes by firing?

int can_destroy_by_attacks Unit actor,
Unit destroyer,
int  u
 

Can a given unit destroy a given utype by attacks?

int can_destroy_by_fire Unit actor,
Unit destroyer,
int  u
 

Can a given unit destroy a given utype by firing?

int can_explore Unit actor,
Unit explorer
 

Can a given unit explore?

int can_overwatch_against_and_defeat Unit actor,
Unit overwatcher,
int  u
 

Can a given unit overwatch against and defeat a given utype?

int can_overwatch_against_and_defeat_any Unit actor,
Unit overwatcher
 

Can a given unit provide defeating overwatch against >= 1 enemy utypes?

int can_prevent_capture_by_any Unit actor,
Unit anticaptor
 

Can a given unit prevent capture by >= 1 enemy utypes?

int can_refuel Unit supplier,
Unit demander,
int  m
 

Can a given unit refuel another given unit with a given fuel?

int can_repair_any Unit actor,
Unit repairer
 

Can given actor-repairer pair repair any utype?

int can_survive_on_known Unit survivor,
int  x,
int  y,
int *  p_without = NULL
 

Can a given unit survive a given known cell?

int can_survive_on_known int  u,
Side side,
int  x,
int  y,
int *  p_without = NULL
 

Can u on a given side survive on a given known cell?

int could_be_occupant int  u  ) 
 

Could u be an occupant of any utypes?

int could_be_occupant_of int  u,
int  u2
 

Could u be an occupant of u2?

Todo:
Consider whether u could ever get in u2 to start with.

int could_colonize int  u  ) 
 

Could u colonize?

int could_counterattack int  u,
int  u2
 

Could u counterattack u2?

int could_countercapture int  u,
int  u2,
Side side
 

Could u countercapture u2 on a given side?

int could_damage int  u,
int  u2
 

Could u damage u2 by any means?

int could_damage_any int  u  ) 
 

Could u damage >= 1 enemy utypes by any means?

int could_damage_by_attacks int  u,
int  u2
 

Could u damage u2 by attacks?

int could_damage_by_combat int  u,
int  u2
 

Could u damage u2 by combat?

int could_damage_by_detonations int  u,
int  u2
 

Could u damage u2 through detonations?

int could_damage_by_fire int  u,
int  u2
 

Could u damage u2 by firing?

int could_defeat_by_attacks int  u,
int  u2,
Side side
 

Could u defeat u2 by attacks?

int could_defeat_by_counterattacks int  u,
int  u2,
Side side
 

Could u defeat u2 by counterattacks?

int could_defeat_by_fire int  u,
int  u2,
Side side
 

Could u defeat u2 by fire?

int could_defend_against int  u,
int  u2,
Side side
 

Could u defend against u2 in any way?

Todo:
Support counterfire.

int could_defend_against_any int  u  ) 
 

Could u defend against >= 1 enemy utypes in any way?

int could_destroy_by_attacks int  u,
int  u2
 

Could u destroy u2 by attacks?

int could_destroy_by_detonations int  u,
int  u2
 

Could u destroy u2 through detonations?

int could_destroy_by_fire int  u,
int  u2
 

Could u destroy u2 by firing?

int could_explore int  u  ) 
 

Could u explore?

int could_overwatch_against int  u,
int  u2,
Side side
 

Could u overwatch against u2?

int could_overwatch_against_and_defeat int  u,
int  u2
 

Could u overwatch against and defeat u2?

int could_prevent_capture_by int  u,
int  u2
 

Could u prevent capture by u2?

int could_prevent_capture_of int  u,
int  u2
 

Could u prevent capture of u2?

int could_see int  u  ) 
 

Could u see?

int detonate_0dist_damage_mean int  u,
int  u2
 

Mean detonate damage that u does to u2 in same cell.

int detonate_damage_mean int  u,
int  u2
 

Mean detonate damage that u does to u2.

int detonate_ranged_damage_mean int  u,
int  u2
 

Mean detonate damage that u does to u2 at range.

int fire_damage_mean int  u,
int  u2
 

Mean fire damage that u does to u2.

int longest_economic_input int  u  ) 
 

Longest direct economic input from any utype to u.

int longest_economic_input int  u,
int  u2
 

Longest direct economic input from u2 to u.

int longest_economic_input int  u,
int  u2,
int  m
 

Longest direct economic input for a material from u2 to u.

int n_detonations_available int  u  ) 
 

Number of detonations available to u before expiring.

void productivity_on_known int *  p_mtypes,
int  u,
Side side,
int  x,
int  y
 

Materials productivity on given known cell for given utype and side.


Variable Documentation

int* cv__longest_economic_inputs
 

Cache of longest direct economic inputs.


Generated on Sat Sep 17 10:28:59 2005 for XconqKernel by doxygen 1.3.6