Class GameParser

Hierarchy

  • GameParser

Constructors

Properties

activePlayer: PlayerColor
board: ChessBoard

Methods

  • Parses a castle move ('O-O' or 'O-O-O') from algebraic notation to a list of MoveActions.

    Parameters

    • san: string

      The move in standard algebraic notation.

    Returns MoveAction[]

    A list of MoveActions to perform on the board.

  • Checks if performing the move would result in the king being in check.

    Parameters

    • move: Move

      The move to be checked.

    • player: PlayerColor

      The moving player.

    Returns boolean

    King would be in check true/false

  • Search the current position for a piece that could perform the move.

    Parameters

    • tarRow: number

      Row number (0-7) of the square the piece should move to.

    • tarCol: number

      Column number (0-7) of the square the piece should move to.

    • mustBeInRow: number

      If value is passed, only pieces in that row are checked.

    • mustBeInCol: number

      If value is passed, only pieces in that column are checked.

    • token: PieceToken

      Type of piece that is looked for.

    • player: PlayerColor

      The moving player

    Returns Move

    The move which will fulfill all criteria.

  • Main function to parse a single move from algebraic notation to a list of Actions.

    Parameters

    • rawMove: string

      The move in standard algebraic notation.

    Returns Action[]

    A list of Actions to perform on the board.

  • Parses a single pawn move from algebraic notation to a list of Actions.

    Parameters

    • san: string

      The move in standard algebraic notation.

    Returns Action[]

    A list of Actions to perform on the board.

  • Parses a single piece move (KQBNR) from algebraic notation to a list of Actions.

    Parameters

    • san: string

      The move in standard algebraic notation.

    Returns Action[]

    A list of Actions to perform on the board.

  • Main function for parsing a read-in PGN game. In here the moves are transformed from algebraic notation to a list of different Actions like MoveAction or CaptureAction. This parsed data is the passed into the Trackers for generating the stats.

    Parameters

    Returns void

  • Helper function to remove special tokens (#, +, ?, !) like ratings (??, ?!) or the check mark (+) from the move.

    Parameters

    • move: string

      The raw move in standard algebraic notation.

    Returns string

    The cleaned move with removed special tokens.

Generated using TypeDoc