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) {
this.chkpt('chessboard-start');
var dep = depth || width;
width = width || 8;
depth = depth || width;
blackBlock = blackBlock || blocks.wool.black;
whiteBlock = whiteBlock || blocks.wool.white;
for(var i = 0; i < width; ++i) {
for(var j = 0; j < dep; ++j) {
for(var j = 0; j < depth; ++j) {
var block = blackBlock;
if((i+j)%2 == 1) {
block = whiteBlock;