added default values for chessboard()

This commit is contained in:
walterhiggins 2013-02-05 20:47:54 +00:00
parent fe3530788a
commit 97553d7da4

View file

@ -11,11 +11,13 @@ load(__folder + "drone.js");
Drone.extend("chessboard", function(whiteBlock, blackBlock, width, depth) { Drone.extend("chessboard", function(whiteBlock, blackBlock, width, depth) {
this.chkpt('chessboard-start'); this.chkpt('chessboard-start');
width = width || 8;
var dep = depth || width; depth = depth || width;
blackBlock = blackBlock || blocks.wool.black;
whiteBlock = whiteBlock || blocks.wool.white;
for(var i = 0; i < width; ++i) { for(var i = 0; i < width; ++i) {
for(var j = 0; j < dep; ++j) { for(var j = 0; j < depth; ++j) {
var block = blackBlock; var block = blackBlock;
if((i+j)%2 == 1) { if((i+j)%2 == 1) {
block = whiteBlock; block = whiteBlock;