Class: BoardPiece

BoardPiece

represents a piece on the board: color, type The instance also has a data field that could be used for private data attached to the piece.

Constructor

new BoardPiece()

Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:

Methods

getData() → {anything}

Method to get secret data for this piece
This:
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:
Returns:
the secret data associated with this piece.
Type
anything

initialize(color, type) → {BoardPiece}

constructs a new object.
This:
Parameters:
Name Type Description
color string color of this piece (black/white).
type string type of this piece (rook/knight/bishop/queen/king/pawn).
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:
Returns:
the new object created.
Type
BoardPiece

setData(data)

Method to set secret data for this piece
This:
Parameters:
Name Type Description
data anything the extra data to hold for this piece.
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:

toString() → {string}

toString method that allows you to get a nice printout for this type
This:
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source:
Returns:
string representation of this object.
Type
string

unsetData()

Method to unset secret data for this piece
This:
Author:
  • mark.veltzer@gmail.com (Mark Veltzer)
Source: