|
|
@ -189,7 +189,7 @@ function sierpinski() { |
|
|
|
* some other tree |
|
|
|
* some other tree |
|
|
|
************************************************/ |
|
|
|
************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
function other_tree(num_defects) { |
|
|
|
function other_tree() { |
|
|
|
project.clear(); |
|
|
|
project.clear(); |
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
var r = generate( |
|
|
|
var r = generate( |
|
|
@ -204,22 +204,6 @@ function sierpinski() { |
|
|
|
8 |
|
|
|
8 |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
var n = 0; |
|
|
|
|
|
|
|
while(n < num_defects) { |
|
|
|
|
|
|
|
var rnd = Math.floor(Math.random()*r.length); |
|
|
|
|
|
|
|
if((r[rnd] != '[') & (r[rnd] != ']')) { |
|
|
|
|
|
|
|
r[rnd] = '*'; |
|
|
|
|
|
|
|
if(Math.random() > 0.9) { |
|
|
|
|
|
|
|
if(Math.random() < 0.5) { |
|
|
|
|
|
|
|
r.splice(rnd, 0, '+'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
r.splice(rnd, 0, '-'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
n += 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(r); |
|
|
|
console.log(r); |
|
|
|
var p = draw( |
|
|
|
var p = draw( |
|
|
|
r, |
|
|
|
r, |
|
|
|