Crystal AI  1.0.0
Crystal.WeightedRandomSelector Class Reference

This selector uses roulette wheel selection of the top P:Crystal.WeightedRandomSelector.Proportion percent utilities in the given T:System.Collections.ICollection of utilities. More...

Inheritance diagram for Crystal.WeightedRandomSelector:
Crystal.ISelector Crystal.IAiPrototype< ISelector >

Public Member Functions

int Select (ICollection< Utility > elements)
 Selects a T:Crystal.Utility from the given set and returns its index. More...
 
ISelector 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...
 
 WeightedRandomSelector ()
 Initializes a new instance of the T:Crystal.WeightedRandomSelector class. More...
 
 WeightedRandomSelector (float proportion)
 Initializes a new instance of the T:Crystal.WeightedRandomSelector class. More...
 
 WeightedRandomSelector (Pcg random)
 Initializes a new instance of the T:Crystal.WeightedRandomSelector class. More...
 
- Public Member Functions inherited from Crystal.IAiPrototype< ISelector >
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

float Proportion [get, set]
 Gets or sets the proportion. More...
 

Detailed Description

This selector uses roulette wheel selection of the top P:Crystal.WeightedRandomSelector.Proportion percent utilities in the given T:System.Collections.ICollection of utilities.

See also
T:Crystal.ISelector

Constructor & Destructor Documentation

Crystal.WeightedRandomSelector.WeightedRandomSelector ( )
inline

Initializes a new instance of the T:Crystal.WeightedRandomSelector class.

Crystal.WeightedRandomSelector.WeightedRandomSelector ( float  proportion)
inline

Initializes a new instance of the T:Crystal.WeightedRandomSelector class.

Parameters
proportionThe proportion.
Crystal.WeightedRandomSelector.WeightedRandomSelector ( Pcg  random)
inline

Initializes a new instance of the T:Crystal.WeightedRandomSelector class.

Parameters
randomThe random.

Member Function Documentation

ISelector Crystal.WeightedRandomSelector.Clone ( )
inline

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
int Crystal.WeightedRandomSelector.Select ( ICollection< Utility elements)
inline

Selects a T:Crystal.Utility from the given set and returns its index.

Parameters
elementsThe elements.
Returns
The index of the selected utility. This returns -1 no selection was made or if the count of elements was 0.

Implements Crystal.ISelector.

Property Documentation

float Crystal.WeightedRandomSelector.Proportion
getset

Gets or sets the proportion.

The proportion.


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