build/ludorum.js
/** The constructor takes `height`, `width`, a list of piece objects and optionally the empty 
	square object. The piece objects must have a property `position`. Only one piece is allowed at
	each square.
	*/
The constructor takes `height`, `width`, a list of piece objects and optionally the empty
square object. The piece objects must have a property `position`. Only one piece is allowed at
each square.
The constructor takes ` height ` ` width ` a list of piece objects and optionally the empty square object . The piece objects must have a property ` position ` . Only one piece is allowed at each square .
function CheckerboardFromPieces(height, width, pieces, emptySquare) {
		Checkerboard.call(this, height, width);
		var board = this;
		if (emptySquare !== this.emptySquare) {
			this.emptySquare = emptySquare;
		}
		if (Array.isArray(pieces)) {
			this.pieces = {}; 
			iterable(pieces || []).forEach(function (piece) {
				raiseIf(!Array.isArray(piece.position), "Piece has not a position (", piece, ")!");
				board.pieces[piece.position +''] = piece;
			});
		} else if (typeof pieces === 'object') {
			this.pieces = base.copy({}, pieces);
		} else {
			raise("Invalid pieces definition: ", pieces, "!");
		}
	}
function CheckerboardFromPieces ( height , width , pieces , emptySquare ) { Checkerboard . call ( this , height , width ) ; var board = this ; if ( emptySquare !== this . emptySquare ) { this . emptySquare = emptySquare ; } if ( Array . isArray ( pieces ) ) { this . pieces = { } ; iterable ( pieces || [ ] ) . forEach ( function ( piece ) { raiseIf ( ! Array . isArray ( piece . position ) , "Piece has not a position (" , piece , ")!" ) ; board . pieces [ piece . position + '' ] = piece ; } ) ; } else if ( typeof pieces === 'object' ) { this . pieces = base . copy ( { } , pieces ) ; } else { raise ( "Invalid pieces definition: " , pieces , "!" ) ; } }
The constructor takes `height`, `width`, a list of piece objects and optionally the empty
square object.
The constructor takes ` height ` ` width ` a list of piece objects and optionally the empty square object .