Rook Class
A Rook class, represents a Bishop piece
Constructor
Rook
(
-
color
-
type
-
X
-
Y
-
id
Parameters:
-
color
Objectrook's color
-
type
Objecttype of the piece, e.g. "Rook"
-
X
Objectx coordinate on the board (0-7), 0 represents 'a' file, 7 represents 'h' file
-
Y
Objecty coordinate on the board (0-7), 0 represents 8-th rank, 7 represnts 1-st rank
-
id
Objectid of the piece
Item Index
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
(
Object
-
x
-
y
moves piece to a new field
Parameters:
-
x
Numberx coordinate of destination
-
y
Numbery coordinate of destination
Returns:
Object:
object represents a summary of the move
Properties
color
String
Rook's color
ID
Number
Rook's ID
notationName
String
notation symbol
type
String
Rook's type
X
Number
x coordinate
Y
Number
y coordinate