-
@constructor Chess
: Setup aboard
withPieces
representing an initial chessboard.-
@method getPlayer()
-
@return String either "white" or "black" representing current player
-
-
@method move(piece, destination)
: Movepiece
todestination
and...?-
@param Piece piece to move
-
@param Position destination to move piece to
-
-
@method opening()
: Advance theboard
to Catalan Opening, Closed Variation -
@method display()
-
@return String representation of board
-
-
R,N,B,Q,K,B,N,R
P,P,P,P,P,P,P,P
, , , , , , ,
, , , , , , ,
, , , , , , ,
, , , , , , ,
p,p,p,p,p,p,p,p
r,n,b,q,k,b,n,r
-
@constructor Position(x,y)
: Represent a position on a chessboard with coordinates- usage:
new Position(1,1)
-
@property Number x coordinate
-
@property Number y coordinate
- usage:
-
@constructor Piece(name, color)
: Represent a chesspiece on theboard
withname
andcolor
and appropriate starting position- usage:
new Piece('Queen', 'black')
-
@method getName()
-
@return String name of Piece, e.g. 'Queen', 'Pawn'
-
-
@method getColor()
:-
@return String player 'black' or 'white'
-
-
@method setPosition(position)
: SetPiece
toposition
on board-
@param Position position
-
-
@method toString()
-
@return String representation of Piece
- example:
"Q" === String(new Piece("Queen", "white"))
- example:
"r" === String(new Piece("Rook", "black"))
-
- usage: