return false

This commit is contained in:
TreetopFlyer 2021-05-29 12:28:46 -04:00
parent 0032f41b01
commit 9ec0f1b8d7

View File

@ -8,48 +8,50 @@
<body>
<script>
var count = 0;
let root = N.Create("root");
var context = {};
let recurse = (node, depth) =>
{
// create a set of new nodes off of the input node
let c1 = N.Create(node.Meta+"-1");
let c2 = N.Create(node.Meta+"-2");
let c1 = N.Create(node.Meta+"-c1");
let c2 = N.Create(node.Meta+"-c2");
N.Connect(node, c1, "parent");
N.Connect(node, c2, "parent");
var iterator;
if(depth < 2)
if(depth < 1)
{
// loop over the new nodes and keep recursing
iterator = (child) =>
N.Walk((child) =>
{
console.log(`subdividing ${child.Meta}`);
context = [child, depth+1];
recurse(child, depth+1);
};
return false;
}
, node, "parent");
}
else
{
// walk up
iterator = (child) =>
N.Walk((child) =>
{
/*
issue: why does incrementing walk id cause an infinite loop
*/
N.ID.Walk++;
count++;
if(count > 100)
console.log(`changing walk ID ${child.Meta}`);
if(N.ID.Walk > 20)
{
console.log("big problems");
throw new Error("holy crap");
}
};
return false;
}
, node, "parent");
}
N.Walk(iterator, node, "parent");
}
N.ID.Walk++;
context = [root, 0];
recurse(root, 0);
</script>