Class BrainBotData<TState, TBot, TAction>
A storage class for bot-related information.
Implements
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain
Assembly: BotBrain.Core.dll
Syntax
[DataContract]
public class BrainBotData<TState, TBot, TAction> : IBrainBotData where TBot : IAutomatedBot<TAction>
  Type Parameters
| Name | Description | 
|---|---|
| TState | A title-specific state object.  | 
      
| TBot | A title-specific bot object that implements IAutomatedBot<TAction>.  | 
      
| TAction | A title-specific bot action that implements IEquatable<T> .  | 
      
Remarks
Initializes a new instance of the BrainBotData<TState, TBot, TAction> class.
Constructors
View SourceBrainBotData(TBot, IReadOnlyCollection<TState>, CancellationToken)
A storage class for bot-related information.
Declaration
public BrainBotData(TBot bot, IReadOnlyCollection<TState> states, CancellationToken token)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TBot | bot | The bot.  | 
      
| IReadOnlyCollection<TState> | states | The states that are associated with the bot.  | 
      
| CancellationToken | token | The cancellation token.  | 
      
Remarks
Initializes a new instance of the BrainBotData<TState, TBot, TAction> class.
Properties
View SourceActionGameDurations
Gets a mapping from action name to the amount of time spent. This is cleared after each game, since if the map changes, the action names are invalid.
Declaration
[DataMember]
public IDictionary<string, TimeSpan> ActionGameDurations { get; }
  Property Value
| Type | Description | 
|---|---|
| IDictionary<string, TimeSpan> | 
AverageUpdateDuration
Gets or sets the rolling average time to update the bot.
Declaration
public TimeSpan AverageUpdateDuration { get; set; }
  Property Value
| Type | Description | 
|---|---|
| TimeSpan | 
BestAction
Gets the chosen action.
Declaration
public TAction BestAction { get; }
  Property Value
| Type | Description | 
|---|---|
| TAction | 
BestUrge
Gets or sets the chosen urge.
Declaration
[DataMember]
public IUrge<TState, TBot, TAction>? BestUrge { get; set; }
  Property Value
| Type | Description | 
|---|---|
| IUrge<TState, TBot, TAction> | 
Bot
Gets the bot.
Declaration
public TBot Bot { get; }
  Property Value
| Type | Description | 
|---|---|
| TBot | 
CancelToken
Gets a cancellation token used to stop controlling the bot.
Declaration
public CancellationToken CancelToken { get; }
  Property Value
| Type | Description | 
|---|---|
| CancellationToken | 
DisabledUrges
Gets a set of urges which are disabled for this bot.
Declaration
[DataMember]
public ISet<IUrge<TState, TBot, TAction>> DisabledUrges { get; }
  Property Value
| Type | Description | 
|---|---|
| ISet<IUrge<TState, TBot, TAction>> | 
GameStates
Gets the game states associated with the bot.
Declaration
public ISet<TState> GameStates { get; }
  Property Value
| Type | Description | 
|---|---|
| ISet<TState> | 
LastUpdateDuration
Gets or sets the time spent during the last time the bot was updated.
Declaration
public TimeSpan? LastUpdateDuration { get; set; }
  Property Value
| Type | Description | 
|---|---|
| TimeSpan? | 
LastUpdateTime
Gets or sets the last time the bot was updated.
Declaration
public DateTime? LastUpdateTime { get; set; }
  Property Value
| Type | Description | 
|---|---|
| DateTime? | 
Recommendations
Gets or sets a mapping from urge to the recommended actions and urgencies.
Declaration
[DataMember]
public IDictionary<IUrge<TState, TBot, TAction>, ICollection<BotBrainUrgeResult<TState, TBot, TAction>>>? Recommendations { get; set; }
  Property Value
| Type | Description | 
|---|---|
| IDictionary<IUrge<TState, TBot, TAction>, ICollection<BotBrainUrgeResult<TState, TBot, TAction>>> | 
StuckDuration
Gets or sets the amount of time the bot was stuck, because none of the urges recommended something.
Declaration
[DataMember]
public TimeSpan StuckDuration { get; set; }
  Property Value
| Type | Description | 
|---|---|
| TimeSpan | 
UpdateCount
Gets or sets the number of times the bot has been updated.
Declaration
public uint UpdateCount { get; set; }
  Property Value
| Type | Description | 
|---|---|
| uint | 
UrgeTotalDurations
Gets a mapping from urge to the amount of time spent.
Declaration
[DataMember]
public IDictionary<IUrge<TState, TBot, TAction>, TimeSpan> UrgeTotalDurations { get; }
  Property Value
| Type | Description | 
|---|---|
| IDictionary<IUrge<TState, TBot, TAction>, TimeSpan> | 
Methods
View SourcePostUpdate(TState, TBot, IReadOnlyCollection<BotBrainUrgeResult<TState, TBot, TAction>>, IUrge<TState, TBot, TAction>?, TAction)
Updates the bot's state based on the urge results.
Declaration
public virtual void PostUpdate(TState state, TBot bot, IReadOnlyCollection<BotBrainUrgeResult<TState, TBot, TAction>> recommendations, IUrge<TState, TBot, TAction>? bestUrge, TAction bestAction)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TState | state | The game state.  | 
      
| TBot | bot | The bot being updated.  | 
      
| IReadOnlyCollection<BotBrainUrgeResult<TState, TBot, TAction>> | recommendations | The urge results.  | 
      
| IUrge<TState, TBot, TAction> | bestUrge | The chosen urge.  | 
      
| TAction | bestAction | The chosen action.  | 
      
PreUpdate(TState, TBot)
Updates the bot's state prior to the brain choosing an urge.
Declaration
public virtual void PreUpdate(TState state, TBot bot)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TState | state | The game state.  | 
      
| TBot | bot | The bot being updated.  | 
      
ToString()
Returns the string representation of the object.
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| string | The string representation of the object.  |