A partial move context

Hierarchy

  • TMoveContext

Constructors

  • Parameters

    • design: TDesign

      a gane design object

    • board: TBoard

      a game state object

    • loc: number

      origin square (the last square that the moving piece passed through)

    • piece: TPiece

      a piece that moves on this turn

    Returns TMoveContext

Properties

board: TBoard
changes: {
    loc: number;
    piece: TPiece;
}[]
design: TDesign
from: number
hand: {
    piece: TPiece;
    start: number;
}

Type declaration

  • piece: TPiece
  • start: number
loc: number
marks: number[]
mode: number
move: TMove
parent: TMoveContext
part: number
piece: TPiece
succeed: boolean

Methods

  • Check whether the target square is not occupied (i.e. whether the piece can move toward the given direction from the current location)

    Parameters

    • params: number[]

      direction that the piece can move toward

    • ix: number

      params array index of the direction that the piece will move toward

    Returns boolean

  • capture a piece on the passing square

    Returns void

  • Finish the context of the current move

    Parameters

    • Optional params: number
    • Optional ix: number

    Returns void

  • Returns

    Parameters

    • loc: number

    Returns TPiece

  • Check if the piece is in the specified zone

    Parameters

    • params: number
    • Optional ix: number

    Returns boolean

  • Check whether the target square of the piece is empty or not

    Returns boolean

  • Check whether an enemy piece is on the given square or not

    Returns boolean

  • Check whether a piece is mine

    Returns

    Returns boolean

  • Returns

    Parameters

    • Optional params: number
    • Optional ix: number

    Returns boolean

  • Returns

    Parameters

    • params: number
    • Optional ix: number

    Returns boolean

  • Returns

    Parameters

    • params: number
    • ix: number

    Returns number

  • Make the current piece promote to another piece of the given type

    Returns

    whether the current piece can promote to the given piece type or not

    Parameters

    • params: number
    • Optional ix: number

    Returns boolean

  • Parameters

    • loc: number
    • piece: TPiece

    Returns void

  • Record the moving piece and its origin square

    Returns void

Generated using TypeDoc