|
|
|
@ -189,7 +189,7 @@ function sierpinski() {
@@ -189,7 +189,7 @@ function sierpinski() {
|
|
|
|
|
* some other tree |
|
|
|
|
************************************************/ |
|
|
|
|
|
|
|
|
|
function other_tree(num_defects) { |
|
|
|
|
function other_tree() { |
|
|
|
|
project.clear(); |
|
|
|
|
if(typeof num_defects == 'undefined') { num_defects = 0 }; |
|
|
|
|
var r = generate( |
|
|
|
@ -204,22 +204,6 @@ function sierpinski() {
@@ -204,22 +204,6 @@ function sierpinski() {
|
|
|
|
|
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); |
|
|
|
|
var p = draw( |
|
|
|
|
r, |
|
|
|
|