Game
Class for manipulating games. It allows starting a game from a configurable initial position and with various configuration options, such as the game type (match or analysis), and how to apply the three-fold repetition and 50-move rules.
This class implements Iterable, allowing easy traversal over the nodes of the main line. The toString function returns the game in PGN format.
This is a facade created to enable exporting the code to JS, though it can also be used directly within the JS modules of any KMP project.
Properties
Indicates whether the 50-move half-move limit has been reached (non-terminal).
Determines how the fifty-move rule is enforced for this game instance. Setting this property will be ignored if the game is immutable.
An optional comment placed immediately after the game's result tag in PGN. This comment is enclosed in braces {}. Setting this property will be ignored if the game is immutable.
An optional end-of-line comment placed immediately after the game's result tag in PGN. This comment follows a semicolon ; and extends until the end of the line. Setting this property will be ignored if the game is immutable.
Indicates whether a position has been repeated five times, leading to an automatic draw according to FIDE rules (terminal).
Indicates whether the 75-move half-move limit has been reached, leading to an automatic draw (terminal).
Determines how the three-fold repetition rule is enforced for this game instance. Setting this property will be ignored if the game is immutable.
Indicates that a three-fold repetition draw can be claimed, as the repetition is impending (e.g., the current move will complete the third repetition).
Functions
Deletes all moves that preceded the provided node in the main line. The node (and its position) becomes the new effective start of the game, creating a new RootNode.
Deletes all moves (the main line continuation and any variations) that follow the provided node. The node provided remains in the game.
Deletes all moves (the main line continuation and any variations) that follow the provided node. The move represented by the node is effectively removed from the game.
Creates a deep copy of this game, converting its mode to ANALYSIS and setting both repetition rules to AWARE. This makes the new instance fully mutable for analysis.