Options
All
  • Public
  • Public/Protected
  • All
Menu

An match created using a Design and a list of Agents. The match can be stopped and resumed with stop, resume, and state and configurations can be retrieved at any point in time with the state and configs fields

see

Design for Design information

see

Agent for Agent information

Hierarchy

  • Match

Index

Constructors

constructor

Properties

agentFiles

agentFiles: GenerationMetaData

agent meta data regarding files, ids, etc.

agents

agents: Array<Agent> = []

List of the agents currently involved in the match.

see

Agent for details on the agents.

creationDate

creationDate: Date

When the match was created (called with new)

design

design: Design

The Design used

Private dimension

dimension: Dimension

finishDate

finishDate: Date

When the match finished

id

id: NanoID

Match ID. It's always a 12 character NanoID

idToAgentsMap

idToAgentsMap: Map<ID, Agent> = new Map()

Map from an Agent.ID ID to the Agent

log

log: Logger = new Logger()

The match logger.

see

Logger for details on how to use this

mapAgentIDtoTournamentID

mapAgentIDtoTournamentID: Map<ID, ID> = new Map()

A mapping from Agent IDs to the tournament id of the Player in a tournament that generated the Agent

matchEngine

matchEngine: MatchEngine

The associated MatchEngine that is running this match and serves as the backend for this match.

matchProcess

matchProcess: ChildProcess

Match process used to store the process governing a match running on a custom design

matchProcessTimer

matchProcessTimer: any

The timer set for the match process

matchStatus

matchStatus: Status = Match.Status.UNINITIALIZED

The current match status

name

name: string

Name of the match

Private nonLocalFiles

nonLocalFiles: Array<string> = []

Non local files that should be removed as they are stored somewhere else. Typically bot files are non local if using a backing storage service

replayFile

replayFile: string

Path to the replay file for this match

replayFileKey

replayFileKey: string

Key used to retrieve the replay file from a storage plugin

Private resolveStopPromise

resolveStopPromise: Function

Resolver for stop Promise

results

results: any = null

The results field meant to store any results retrieved with Design.getResults

default

null

Private resumePromise

resumePromise: Promise<void>

Promise for resuming

Private resumeResolve

resumeResolve: Function

Resolver for the above promise

Private runReject

runReject: Function

Rejecter for the run promise

Private shouldStop

shouldStop: boolean = false

Signal to stop at next time step

state

state: any

The state field. This can be used to store anything by the user when this match is passed to the Design life cycle functions Design.initialize, Design.update, and Design.getResults

This is also used by the CustomDesign class to store all standard outputted match output for matches running using a custom design and passing in Design.OverrideOptions.

timeStep

timeStep: number = 0

The current time step of the Match. This time step is independent of any Design and agents are coordianted against this timeStep

Methods

destroy

  • destroy(): Promise<void>

getMatchErrorLogDirectory

  • getMatchErrorLogDirectory(): string

getResults

  • getResults(): Promise<any>

Private handleLogFiles

  • handleLogFiles(): Promise<void>

initialize

  • initialize(): Promise<boolean>

kill

  • kill(agent: ID | Agent, reason?: string): Promise<void>

Private killAndCleanUp

  • killAndCleanUp(): Promise<void>

next

resume

  • resume(): Promise<void>

Private retrieveBot

  • retrieveBot(botkey: string, file: string, useCached: boolean): Promise<string>
  • Retrieves a bot through its key and downloads it to a random generated folder. Returns the new file's path

    Parameters

    • botkey: string
    • file: string
    • useCached: boolean

      if true, storage plugin will avoid redownloading data. If false, storage plugin will always redownload data

    Returns Promise<string>

run

  • run(): Promise<any>

send

  • send(message: string, receiver: Agent | ID): Promise<boolean>

sendAll

  • sendAll(message: string): Promise<boolean>

step

stop

  • stop(): Promise<void>
  • Stops the match. For non-custom designs, stops at the next nearest timestep possible. Otherwise attempts to stop the match using the MatchEngine stopCustom function.

    Notes:

    • If design uses a PARALLEL match engine, stopping behavior can be a little unpredictable
    • If design uses a SEQUENTIAL match engine, a stop will result in ensuring all agents complete all their actions up to a coordinated stopping timeStep

    Returns Promise<void>

throw

  • throw(agentID: ID, error: Error): Promise<void>
  • Throw an FatalError, MatchError, or MatchWarn within the Match. Indicates that the Agent with id agentID caused this error/warning.

    Throwing MatchWarn will just log a warning level message and throwing a MatchError will just log it as an error level message.

    Throwing FatalError will cause the match to automatically be destroyed. This is highly not recommended and it is suggested to have some internal logic to handle moments when the match cannot continue.

    Examples are misuse of an existing command or using incorrect commands or sending too many commands

    Parameters

    • agentID: ID

      the misbehaving agent's ID

    • error: Error

      The error

    Returns Promise<void>

Static genMatchID

  • genMatchID(): string

Object literals

configs

configs: object

Match Configurations. See Match.Configs for configuration options

agentOptions

agentOptions: Options = deepCopy(Agent.OptionDefaults)

agentSpecificOptions

agentSpecificOptions: undefined[] = []

detached

detached: false = false

engineOptions

engineOptions: {}

Type declaration

languageSpecificAgentOptions

languageSpecificAgentOptions: {}

Type declaration

loggingLevel

loggingLevel: INFO = Logger.LEVEL.INFO

name

name: string = ""

secureMode

secureMode: false = false

storeErrorDirectory

storeErrorDirectory: string = "errorlogs"

storeErrorLogs

storeErrorLogs: true = true

storeMatchErrorLogs

storeMatchErrorLogs: false = false

storeReplay

storeReplay: true = true

storeReplayDirectory

storeReplayDirectory: string = "replays"

Generated using TypeDoc