Class BotInfo
Bot info contains the properties of a bot.
Inherited Members
Namespace: Robocode.TankRoyale.BotApi
Assembly: api.dll
Syntax
[PublicAPI]
public sealed class BotInfo
Constructors
| Edit this page View SourceBotInfo(string, string, IList<string>, string, string, IList<string>, ISet<string>, string, string, InitialPosition)
Initializes a new instance of the BotInfo class.
Note that the recommended method for creating a BotInfo class is to use the BotInfo.IBuilder interface provided with the static Builder() method.
Declaration
public BotInfo(string name, string version, IList<string> authors, string description, string homepage, IList<string> countryCodes, ISet<string> gameTypes, string platform, string programmingLang, InitialPosition initialPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the bot (required). |
| string | version | The version of the bot (required). |
| IList<string> | authors | The author(s) of the bot (required). |
| string | description | A short description of the bot (optional). |
| string | homepage | The URL to a web page for the bot (optional). |
| IList<string> | countryCodes | The country code(s) for the bot (optional). |
| ISet<string> | gameTypes | The game type(s) that this bot can handle (optional). |
| string | platform | The platform used for running the bot (optional). |
| string | programmingLang | The programming language used for developing the bot (optional). |
| InitialPosition | initialPosition | The initial position with starting coordinate and angle (optional). |
BotInfo(string, string, IList<string>, string, string, IList<string>, ISet<string>, string, string, InitialPosition, string)
Initializes BotInfo with an optional full name used by team APIs.
Declaration
public BotInfo(string name, string version, IList<string> authors, string description, string homepage, IList<string> countryCodes, ISet<string> gameTypes, string platform, string programmingLang, InitialPosition initialPosition, string teamMemberName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The display name of the bot. |
| string | version | The version of the bot. |
| IList<string> | authors | The author(s) of the bot. |
| string | description | A short description of the bot. |
| string | homepage | The URL to the bot's homepage. |
| IList<string> | countryCodes | The country code(s) for the bot. |
| ISet<string> | gameTypes | The game types that this bot can handle. |
| string | platform | The platform used for running the bot. |
| string | programmingLang | The programming language used for the bot. |
| InitialPosition | initialPosition | The initial position used for debugging. |
| string | teamMemberName | The optional full team-member name, without a display-name length limit. |
Fields
| Edit this page View SourceMaxAuthorLength
The maximum number of characters accepted for an author name is 20.
Declaration
public const int MaxAuthorLength = 20
Field Value
| Type | Description |
|---|---|
| int |
MaxDescriptionLength
The maximum number of characters accepted for the description is 250.
Declaration
public const int MaxDescriptionLength = 250
Field Value
| Type | Description |
|---|---|
| int |
MaxGameTypeLength
The maximum number of characters accepted for a game type is 20.
Declaration
public const int MaxGameTypeLength = 20
Field Value
| Type | Description |
|---|---|
| int |
MaxHomepageLength
The maximum number of characters accepted for the link to the homepage is 150.
Declaration
public const int MaxHomepageLength = 150
Field Value
| Type | Description |
|---|---|
| int |
MaxNameLength
The maximum number of characters accepted for the name is 30.
Declaration
public const int MaxNameLength = 30
Field Value
| Type | Description |
|---|---|
| int |
MaxNumberOfAuthors
The maximum number of authors accepted is 20.
Declaration
public const int MaxNumberOfAuthors = 20
Field Value
| Type | Description |
|---|---|
| int |
MaxNumberOfCountryCodes
The maximum number of country codes accepted is 20.
Declaration
public const int MaxNumberOfCountryCodes = 20
Field Value
| Type | Description |
|---|---|
| int |
MaxNumberOfGameTypes
The maximum number of game types accepted is 10.
Declaration
public const int MaxNumberOfGameTypes = 10
Field Value
| Type | Description |
|---|---|
| int |
MaxPlatformLength
The maximum number of characters accepted for a game type is 20.
Declaration
public const int MaxPlatformLength = 20
Field Value
| Type | Description |
|---|---|
| int |
MaxProgrammingLangLength
The maximum number of characters accepted for the programming language name is 30.
Declaration
public const int MaxProgrammingLangLength = 30
Field Value
| Type | Description |
|---|---|
| int |
MaxVersionLength
The maximum number of characters accepted for the version is 20.
Declaration
public const int MaxVersionLength = 20
Field Value
| Type | Description |
|---|---|
| int |
Properties
| Edit this page View SourceAuthors
List of author(s) of the bot, e.g., "John Doe (johndoe@somewhere.io)". At least one author must be provided.
The maximum number of authors accepted is 20.
The maximum number of characters accepted for an author name is 20.
Declaration
public IList<string> Authors { get; }
Property Value
| Type | Description |
|---|---|
| IList<string> | The author(s) of the bot. |
CountryCodes
The country code(s) defined by ISO 3166-1 alpha-2, e.g. "us": https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. If no country code is provided, the locale of the system is being used instead.
The maximum number of country codes accepted is 20.
Declaration
public IList<string> CountryCodes { get; }
Property Value
| Type | Description |
|---|---|
| IList<string> | The country code(s) for the bot. |
Description
Short description of the bot, preferably a one-liner. This field is optional.
The maximum number of characters accepted for the description is 250.
Declaration
public string Description { get; }
Property Value
| Type | Description |
|---|---|
| string | A short description of the bot. |
GameTypes
The game type(s) accepted by the bot, e.g., "classic", "melee", "1v1". This field must always be provided with the bot info. The game types define which game types the bot can participate in. See GameType for using predefined game type.
The maximum number of game types accepted is 10.
The maximum number of characters accepted for a game type is 20.
Declaration
public ISet<string> GameTypes { get; }
Property Value
| Type | Description |
|---|---|
| ISet<string> | The game type(s) that this bot can handle. |
Homepage
The URL of a web page for the bot (optional).
The maximum number of characters accepted for the link to the homepage is 150.
Declaration
public string Homepage { get; }
Property Value
| Type | Description |
|---|---|
| string | The URL of a web page for the bot. |
InitialPosition
The initial starting position used for debugging only, which must be enabled at the server.
Declaration
public InitialPosition InitialPosition { get; }
Property Value
| Type | Description |
|---|---|
| InitialPosition | The initial starting position used for debugging only. |
Name
The name, e.g., "MyBot". This field must always be provided with the bot info.
The maximum number of characters accepted for the name is 30.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string | The name of the bot. |
Platform
The platform used for running the bot, e.g., ".NET 6.0" (optional).
The maximum number of characters accepted for a game type is 20.
Declaration
public string Platform { get; }
Property Value
| Type | Description |
|---|---|
| string | The platform used for running the bot. |
ProgrammingLang
The programming language used for developing the bot, e.g., "C# 8.0" or "F#" (optional).
The maximum number of characters accepted for the programming language name is 30.
Declaration
public string ProgrammingLang { get; }
Property Value
| Type | Description |
|---|---|
| string | The programming language used for developing the bot. |
TeamMemberName
The optional full name used to identify this bot in team APIs.
Declaration
public string TeamMemberName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This value is not limited by the display-name length. If absent, the server uses the display name.
Version
The version, e.g., "1.0". This field must always be provided with the bot info.
The maximum number of characters accepted for the version is 20.
Declaration
public string Version { get; }
Property Value
| Type | Description |
|---|---|
| string | The version of the bot. |
Methods
| Edit this page View SourceBuilder()
Returns a builder for a convenient way of building a BotInfo object using the builder pattern.
Declaration
public static BotInfo.IBuilder Builder()
Returns
| Type | Description |
|---|---|
| BotInfo.IBuilder | A builder for building a BotInfo object. |
Examples
Example of use:
BotInfo botInfo = BotInfo.Builder()
.SetName("Rampage")
.SetVersion("1.0")
.AddAuthor("John Doh")
.SetGameTypes(new List { GameType.Classic, GameType.Melee })
.Build();
|
Edit this page
View Source
FromConfiguration(IConfiguration)
Reads the bot info from a configuration.
See FromFile(string, string) for an example file.
Declaration
public static BotInfo FromConfiguration(IConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | configuration | Is the configuration |
Returns
| Type | Description |
|---|---|
| BotInfo | A BotInfo instance containing the bot properties read from the configuration. |
FromFile(string, string)
Reads the bot info from a file at the specified base path. The file is assumed to be in JSON format.
Declaration
public static BotInfo FromFile(string filePath, string basePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Is the file path, e.g. "bot-settings.json |
| string | basePath | Is the base path, e.g. |
Returns
| Type | Description |
|---|---|
| BotInfo | A BotInfo instance containing the bot properties read from the configuration. |
Examples
Example file in JSON format:
{
"name": "MyBot",
"version": "1.0",
"authors": "John Doe",
"description": "Short description",
"url": "https://somewhere.net/MyBot",
"countryCodes": "us",
"gameTypes": "classic, melee, 1v1",
"platform": ".NET 6.0",
"programmingLang": "C# 10.0",
"initialPosition": "50,50, 90"
}
Note that these fields are required as these are used to identify the bot:
- name
- version
- authors
- authors, e.g. "John Doe, Jane Doe"
- countryCodes, e.g. "se, no, dk"
- gameTypes, e.g. "classic, melee, 1v1"
initialPosition variable is optional and should only be used for debugging.
The gameTypes is optional, but can be used to limit which game types the bot is capable of
participating in.