Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AI

This is the class to play the Chess game. This is where you should build your AI.

Hierarchy

  • BaseAI
    • AI

Index

Properties

game

game: Game

The reference to the Game instance this AI is playing.

player

player: Player

The reference to the Player this AI controls in the Game.

Methods

ended

  • ended(won: boolean, reason: string): Promise<void>
  • This is called when the game ends, you can clean up your data and dump files here if need be.

    Parameters

    • won: boolean

      True means you won, false means you lost.

    • reason: string

      The human readable string explaining why you won or lost.

    Returns Promise<void>

gameUpdated

  • gameUpdated(): Promise<void>
  • This is called every time the game's state updates, so if you are tracking anything you can update it here.

    Returns Promise<void>

getName

  • getName(): string
  • This is the name you send to the server so your AI will control the player named this string.

    Returns string

    A string for the name of your player.

getSetting

  • getSetting(key: string): string | undefined
  • Gets an AI setting passed to the program via the --aiSettings flag. If the flag was set it will be returned as a string value, undefined otherwise.

    Parameters

    • key: string

      The key of the setting you wish to get the value for.

    Returns string | undefined

    A string representing the value set via command line, or undefined if the key was not set.

invalid

  • invalid(message: string): Promise<void>
  • Invoked after this AI sends some run that is invalid

    Parameters

    • message: string

      The human readable error message about why it did something invalid.

    Returns Promise<void>

makeMove

  • makeMove(): Promise<string>
  • This is called every time it is this AI.player's turn to make a move.

    Returns Promise<string>

    A string in Universal Chess Interface (UCI) or Standard Algebraic Notation (SAN) formatting for the move you want to make. If the move is invalid or not properly formatted you will lose the game.

start

  • start(): Promise<void>
  • This is called once the game starts and your AI knows its playerID and game. You can initialize your AI here.

    Returns Promise<void>

Generated using TypeDoc