Class Game

Chess game, with the move history, the position at each step of the game, the comments and annotations (if any), the result of the game, and some meta-data such as the name of the players, the date of the game, the name of the tournament, etc...

Hierarchy

  • Game

Constructors

Methods

  • Get the name of the annotator.

    Returns undefined | string

  • Set the name of the annotator.

    Parameters

    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Return a human-readable string representing the game. This string is multi-line, and is intended to be displayed in a fixed-width font (similarly to an ASCII-art picture).

    Returns string

  • Get the date of the game.

    Returns undefined | DateValue

  • Set the date of the game.

    Parameters

    • value: undefined | Date | DateValue

      If undefined, the existing value (if any) is erased.

    Returns void

  • Set the date of the game.

    If the month and/or the day of month are missing, the date of the game will be partially defined (see DateValue for more details regarding partially defined dates).

    Parameters

    • year: number
    • Optional month: number
    • Optional day: number

    Returns void

  • Get the date of the game as a standard JavaScript Date object.

    If the day of month is undefined for the current game, the returned Date object points at the first day of the corresponding month. If neither the day of month nor the month are undefined for the current game, the returned Date object points at the first day of the corresponding year.

    Returns undefined | Date

  • Get the date of the game as a human-readable string (e.g. 'November 1955', 'September 4, 2021').

    Parameters

    • Optional locales: string | string[]

      Locales to use to generate the result. If undefined, the default locale of the execution environment is used. See Intl documentation for more details.

    Returns undefined | string

  • Get the event.

    Returns undefined | string

  • Set the event.

    Parameters

    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Return the node or variation corresponding to the given ID (see id and id to retrieve the ID of a node or variation).

    Returns

    undefined if the given ID does not correspond to an existing Node and Variation.

    Parameters

    • id: string

    Returns undefined | Node | Variation

  • Get the initial position of the game.

    Returns Position

  • Set the initial position of the game.

    Parameters

    • initialPosition: Position
    • Optional fullMoveNumber: number

      1 by default

    Returns void

  • Return the nodes corresponding to the moves of the main variation.

    Parameters

    • withSubVariations: boolean = false

      If true, the nodes of the sub-variations are also included in the result.

    Returns Node[]

  • Get the elo of the player corresponding to the given color.

    If defined, the returned value is guaranteed to be an integer >= 0.

    Parameters

    Returns undefined | number

  • Set the elo of the player corresponding to the given color.

    Parameters

    • color: Color
    • value: undefined | number

      If undefined, the existing value (if any) is erased. Must be an integer >= 0.

    Returns void

  • Get the name of the player corresponding to the given color.

    Parameters

    Returns undefined | string

  • Set the name of the player corresponding to the given color.

    Parameters

    • color: Color
    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Get the title of the player corresponding to the given color.

    Parameters

    Returns undefined | string

  • Set the title of the player corresponding to the given color.

    Parameters

    • color: Color
    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Get the round.

    Returns undefined | string

  • Set the round.

    Parameters

    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

  • Get where the game takes place.

    Returns undefined | string

  • Set where the game takes place.

    Parameters

    • value: undefined | string

      If undefined, the existing value (if any) is erased.

    Returns void

Generated using TypeDoc