48 lines
1008 B
HTML
Executable File
48 lines
1008 B
HTML
Executable File
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<script src="N.js"></script>
|
|
<script src="Pivot.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
let root = N.Create("root");
|
|
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");
|
|
N.Connect(node, c1, "parent");
|
|
N.Connect(node, c2, "parent");
|
|
|
|
var iterator;
|
|
if(depth < 3)
|
|
{
|
|
// loop over the new nodes and keep recursing
|
|
|
|
iterator = (child) =>
|
|
{
|
|
recurse(child, depth+1);
|
|
};
|
|
}
|
|
else
|
|
{
|
|
// walk up
|
|
iterator = () =>
|
|
{
|
|
|
|
};
|
|
}
|
|
|
|
N.Walk(iterator, node, "parent", true);
|
|
}
|
|
recurse(root, 0);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|