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) {
|
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;
|
||||||
|
|
Reference in a new issue