[x] @constructor Position(x,y): Represent a position on a chessboard with coordinates
usage: new Position(1,1)
[x] @property Number x coordinate
[x] @property Number y coordinate
[x] @constructor Piece(name, color): Represent a chesspiece on the board with name and color and appropriate starting position
usage: new Piece('Queen', 'black')
[x] @method getName()
[x] @return String name of Piece, e.g. 'Queen', 'Pawn'
[x] @method getColor():
[x] @method setPosition(position): Set Piece to position on board
Resources:
Let's build a Game!
Reading JavaScript (50)
Capitalized
function definitions (Constructors)new
keywordprototypes
everywhereChessboard Interface
@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
@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
@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()
:@method setPosition(position)
: SetPiece
toposition
on board@param Position position
@method toString()
@return String representation of Piece
"Q" === String(new Piece("Queen", "white"))
"r" === String(new Piece("Rook", "black"))
Reading JavaScript
var
foo
foo
=
foo
,'bar'
'bar'
;
var foo = 'bar'
//