added default values for chessboard()
This commit is contained in:
parent
fe3530788a
commit
97553d7da4
1 changed files with 22 additions and 20 deletions
|
@ -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;
|
||||
|
|
Reference in a new issue