Show / Hide Table of Contents

Class BrainBotData<TState, TBot, TAction>

A storage class for bot-related information.

Inheritance
object
BrainBotData<TState, TBot, TAction>
Implements
IBrainBotData
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
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 Source

BrainBotData(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 Source

ActionGameDurations

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>
View Source

AverageUpdateDuration

Gets or sets the rolling average time to update the bot.

Declaration
public TimeSpan AverageUpdateDuration { get; set; }
Property Value
Type Description
TimeSpan
View Source

BestAction

Gets the chosen action.

Declaration
public TAction BestAction { get; }
Property Value
Type Description
TAction
View Source

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>
View Source

Bot

Gets the bot.

Declaration
public TBot Bot { get; }
Property Value
Type Description
TBot
View Source

CancelToken

Gets a cancellation token used to stop controlling the bot.

Declaration
public CancellationToken CancelToken { get; }
Property Value
Type Description
CancellationToken
View Source

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>>
View Source

GameStates

Gets the game states associated with the bot.

Declaration
public ISet<TState> GameStates { get; }
Property Value
Type Description
ISet<TState>
View Source

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?
View Source

LastUpdateTime

Gets or sets the last time the bot was updated.

Declaration
public DateTime? LastUpdateTime { get; set; }
Property Value
Type Description
DateTime?
View Source

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>>>
View Source

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
View Source

UpdateCount

Gets or sets the number of times the bot has been updated.

Declaration
public uint UpdateCount { get; set; }
Property Value
Type Description
uint
View Source

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 Source

PostUpdate(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.

View Source

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.

View Source

ToString()

Returns the string representation of the object.

Declaration
public override string ToString()
Returns
Type Description
string

The string representation of the object.

Overrides
object.ToString()

Implements

IBrainBotData
  • View Source
In this article
Back to top Generated by DocFX