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

new Game()

Methods

annotator(valuenullable)

Set the name of the annotator.

Parameters:
Name Type Attributes Description
value string <nullable>

annotator()nullable {string}

Get the name of the annotator.

Returns:
string

date(value)

Set the date of the game.

Parameters:
Name Type Description
value Date | Object | Object | undefined

date() → {Date|Object|Object|undefined}

Get the date of the game.

Returns:
Date | Object | Object | undefined -

Depending on what is defined, the method returns the whole date, or just the year and the month, or just the year, or undefined.

event(valuenullable)

Set the event.

Parameters:
Name Type Attributes Description
value string <nullable>

event()nullable {string}

Get the event.

Returns:
string

initialPosition() → {Position}

Get the initial position of the game.

Returns:
Position

initialPosition(initialPosition, fullMoveNumberopt)

Set the initial position of the game.

WARNING: this resets the main variation.

Parameters:
Name Type Attributes Default Description
initialPosition Position
fullMoveNumber number <optional>
1

mainVariation() → {Variation}

The main variation of the game.

Returns:
Variation

playerElo(color)nullable {string}

Get the player elo.

Parameters:
Name Type Description
color Color
Returns:
string

playerElo(color, valuenullable)

Set the player elo.

Parameters:
Name Type Attributes Description
color Color
value string <nullable>

playerName(color)nullable {string}

Get the player name.

Parameters:
Name Type Description
color Color
Returns:
string

playerName(color, valuenullable)

Set the player name.

Parameters:
Name Type Attributes Description
color Color
value string <nullable>

playerTitle(color)nullable {string}

Get the player title.

Parameters:
Name Type Description
color Color
Returns:
string

playerTitle(color, valuenullable)

Set the player title.

Parameters:
Name Type Attributes Description
color Color
value string <nullable>

result(value)

Set the result of the game.

Parameters:
Name Type Description
value GameResult

result() → {GameResult}

Get the result of the game.

Returns:
GameResult

round()nullable {string}

Get the round.

Returns:
string

round(valuenullable)

Set the round.

Parameters:
Name Type Attributes Description
value string <nullable>

site()nullable {string}

Get where the game takes place.

Returns:
string

site(valuenullable)

Set where the game takes place.

Parameters:
Name Type Attributes Description
value string <nullable>

variant() → {GameVariant}

Get the GameVariant of the game.

Returns:
GameVariant