API Docs for:
Show:

Bishop Class

A Bishop class, represents a Bishop piece

Constructor

Bishop

(
  • color
  • type
  • X
  • Y
  • id
)

Parameters:

  • color Object

    bishop's color

  • type Object

    type of the piece, e.g. "Bishop"

  • X Object

    x coordinate on the board (0-7), 0 represents 'a' file, 7 represents 'h' file

  • Y Object

    y coordinate on the board (0-7), 0 represents 8-th rank, 7 represnts 1-st rank

  • id Object

    id of the piece

Methods

getCoveredFields

() Array

get piece covered fields

Returns:

Array:

an array of (x,y) coordinates represents a set of fields, covered by a piece

getImageSource

() String

get relative path to the piece image

Returns:

String:

path to the piece image

getLegalMoves

() Array

get piece legal moves

Returns:

Array:

an array of (x,y) coordinates represents a legal moves for a piece

getNotationSymbol

() String

get notation symbol of the piece

Returns:

String:

notation symbol

move

(
  • x
  • y
)
Object

moves piece to a new field

Parameters:

  • x Number

    x coordinate of destination

  • y Number

    y coordinate of destination

Returns:

Object:

object represents a summary of the move

Properties

color

String

Bishop's color

ID

Number

Bishop's ID

notationName

String

notation symbol

type

String

Bishop's type

X

Number

x coordinate

Y

Number

y coordinate