Crystal AI  1.0.0
Crystal.Behaviour Class Reference

An AI behaviour is a set of T:Crystal.IOptions. The behaviour itself is a composite consideration and therefore, unless this is the only behaviour in a T:Crystal.IUtilityAi, it will be selected only if its considerations "win" against competing behaviours in the AI. More...

Inheritance diagram for Crystal.Behaviour:
Crystal.CompositeConsideration Crystal.IBehaviour Crystal.ICompositeConsideration Crystal.ICompositeConsideration Crystal.IConsideration Crystal.IConsideration Crystal.IAiPrototype< IConsideration > Crystal.IAiPrototype< IConsideration >

Classes

class  BehaviourAlreadyExistsInCollectionException
 
class  BehaviourCollectionNullException
 

Public Member Functions

bool AddOption (IOption option)
 Adds the option. More...
 
bool AddOption (string optionId)
 Adds the option associated with optionId, if one exists. More...
 
IAction Select (IContext context)
 Selects the action for execution, given the specified context. More...
 
override IConsideration Clone ()
 Creates a new instance of the implementing class. Note that the semantics here are somewhat vague, however, by convention the "Prototype Pattern" uses a "Clone" function. Note that this may have very different semantics when compared with either shallow or deep cloning. When implementing this remember to include only the defining characteristics of the class and not its state! More...
 
 Behaviour ()
 Initializes a new instance of the Behaviour class. More...
 
 Behaviour (string nameId, IBehaviourCollection collection)
 Initializes a new instance of the Behaviour class. More...
 
- Public Member Functions inherited from Crystal.CompositeConsideration
bool AddConsideration (IConsideration consideration)
 Add the specified consideration. More...
 
bool AddConsideration (string considerationId)
 Add the consideration associated with the given Id. More...
 
virtual void Consider (IContext context)
 Calculates the utility for this option given the provided context. More...
 
 CompositeConsideration ()
 Initializes a new instance of the T:Crystal.CompositeConsideration class. More...
 
 CompositeConsideration (string nameId, IConsiderationCollection collection)
 Initializes a new instance of the CompositeConsideration class. More...
 
- Public Member Functions inherited from Crystal.IAiPrototype< IConsideration >
Clone ()
 Creates a new instance of the implementing class. Note that the semantics here are somewhat vague, however, by convention the "Prototype Pattern" uses a "Clone" function. Note that this may have very different semantics when compared with either shallow or deep cloning. When implementing this remember to include only the defining characteristics of the class and not its state! More...
 

Properties

ISelector Selector [get, set]
 T:Crystal.ISelector More...
 
- Properties inherited from Crystal.CompositeConsideration
string NameId [get, set]
 An identifier for this consideration. More...
 
IMeasure Measure [get, set]
 The measure to be used to evaluate the utility of this consideration. More...
 
Utility DefaultUtility [get, set]
 Gets or sets the default utility. More...
 
Utility Utility [get, protected set]
 Returns the combined utility for this consideration. More...
 
float Weight [get, set]
 Gets the weight of this consideration. More...
 
bool IsInverted [get, set]
 If true, then the output of the associated evaluator is inverted, in effect, inverting the consideration. More...
 
- Properties inherited from Crystal.ICompositeConsideration
IMeasure Measure [get, set]
 The measure to be used to evaluate the utility of this consideration. More...
 
- Properties inherited from Crystal.IConsideration
string NameId [get]
 A unique named identifier for this consideration. More...
 
Utility DefaultUtility [get, set]
 Gets or sets the default utility. More...
 
Utility Utility [get]
 Returns the utility for this consideration. More...
 
float Weight [get, set]
 The weight of this consideration. More...
 
bool IsInverted [get, set]
 If true, then the output of the associated evaluator is inverted, in effect, inverting the consideration. More...
 
- Properties inherited from Crystal.IBehaviour
ISelector Selector [get, set]
 T:Crystal.ISelector More...
 

Additional Inherited Members

- Protected Member Functions inherited from Crystal.CompositeConsideration
 CompositeConsideration (CompositeConsideration other)
 Initializes a new instance of the T:Crystal.CompositeConsideration class. More...
 
 CompositeConsideration (IConsiderationCollection collection)
 Initializes a new instance of the T:Crystal.CompositeConsideration class. More...
 

Detailed Description

An AI behaviour is a set of T:Crystal.IOptions. The behaviour itself is a composite consideration and therefore, unless this is the only behaviour in a T:Crystal.IUtilityAi, it will be selected only if its considerations "win" against competing behaviours in the AI.

See also
T:Crystal.CompositeConsideration, T:Crystal.IBehaviour

Constructor & Destructor Documentation

Crystal.Behaviour.Behaviour ( )
inline

Initializes a new instance of the Behaviour class.

Crystal.Behaviour.Behaviour ( string  nameId,
IBehaviourCollection  collection 
)
inline

Initializes a new instance of the Behaviour class.

Parameters
nameIdThe name identifier.
collectionThe collection.
Exceptions
Crystal.Behaviour.BehaviourCollectionNullException
Crystal.Behaviour.BehaviourAlreadyExistsInCollectionException

Member Function Documentation

bool Crystal.Behaviour.AddOption ( IOption  option)
inline

Adds the option.

Parameters
optionThe option.
Returns
bool Crystal.Behaviour.AddOption ( string  optionId)
inline

Adds the option associated with optionId, if one exists.

Parameters
optionIdThe option identifier.
Returns
Returns true if the option was successfully added, false otherwise.

Implements Crystal.IBehaviour.

override IConsideration Crystal.Behaviour.Clone ( )
inlinevirtual

Creates a new instance of the implementing class. Note that the semantics here are somewhat vague, however, by convention the "Prototype Pattern" uses a "Clone" function. Note that this may have very different semantics when compared with either shallow or deep cloning. When implementing this remember to include only the defining characteristics of the class and not its state!

Returns

Reimplemented from Crystal.CompositeConsideration.

IAction Crystal.Behaviour.Select ( IContext  context)
inline

Selects the action for execution, given the specified context.

Parameters
contextThe context.
Returns
The action to execute.

Implements Crystal.IBehaviour.

Property Documentation

ISelector Crystal.Behaviour.Selector
getset

T:Crystal.ISelector

The selector used in this behaviour. Note this cannot be null and because of this if a null value set is attempted this is simply ignored and the previous value is retained.


The documentation for this class was generated from the following file: