Thursday, August 02, 2007

Possible Implementation of a Monkey Tree

I’m just putting this out there so that you guys can tell me how buggy it is before we actually attempt to add it to the ruleset.

The Monkey Tree is an endless tree made of Nodes, each of which can be termed a Root, a Junction, or a Leaf. The Nodes may each contain zero or more Monkeys.  No Monkey may occupy more than one Node of the tree at a time.

There is one Node of the Monkey Tree which is known as the Root.  The Root is always a part of the Monkey Tree.  If the Root contains no Monkeys, the tree is Empty, and the Root contains no Branches.  If the Root contains any Monkeys, than it has two Branches; a Left Branch and a Right Branch.  Each of these Branches contains one Node.

All other Nodes in the tree are either referred to as Junctions or Leaves.  Every Junction contains two Branches; a Left Branch, and a Right Branch.  Each of these Branches contains one Node.

If a Leaf has any Monkeys in it, it becomes a Junction.  If a Junction contains no Monkeys, and neither of the Nodes in its Branches are Junctions, it becomes a Leaf, and the Nodes that were formerly in its Branches are no longer considered to be part of the tree.  If a Junction or the Root contains no Monkeys, but one or both of the Nodes in its Branches are Junctions, than any Monkey may move either the Monkey in the Node in the Junction’s Left Branch or the Monkey in the Node in the Junction’s Right Branch into the Junction.

If a Junction or the Root ever contains more than one Monkey, than any Monkey may either move the Monkey whose name occurs earlier in the alphabet to the Node in the Junction or Root’s Left Branch, or move the Monkey whose name occurs later in the alphabet to the Junction or Root’s Right Branch.

Whenever a Monkey’s status is changed to “In the Tree”, they move into the Root of the tree.

This tree just sorts Monkeys by name at the moment, but it could be modified to sort them by Fritos, or bananas, or dance moves, or whatever.  I don’t know if Clucky intended this be the kind of tree than could sort things, or the kind of tree that Monkeys can climb around at will, though, so all that could be modified.  If you want to make it some kind of dynamically resizable non-binary tree, that could get pretty complicated, though… Anyway, this actually works opposite to the way programming trees do because all Monkeys are added at the root and rest of the tree just reshuffles itself.  I didn’t think it would be worth it to write complicated instructions on how to navigate to the right Leaf when we can just make a simple instruction about how to deal with each overcrowded Junction.

Also, if we wind up representing it in a tree-like structure in the wiki, I’d personally prefer it have the root at the bottom.  Unlike programmers and syntacticians, Monkeys know that trees grow UP.

Thoughts?

ETA:  Perhaps we should initialize the Branch-Nodes of newly created Leaf-to-Junctions to Leaves?  I don’t think it really matters, since Junctions with no Monkeys in them become Leaves anyway.  We’d also have to make sure multiple Monkeys can’t leave the tree before someone gets to updating it, because if the Monkeys in a Junction and its two Branch-Nodes all left at one, than parts of the tree would go permanently missing.

Son-of-a-ETA:  I don’t seem to be able to log into or make changes to the wiki.  I know my browser is saving cookies.  Help?

Comments

Elias IX:

08-02-2007 05:52:47 UTC

Oh, this thing is beautiful, but I’ve never had an eye for scammability.

Also, the wiki has a separate registration than the main Blognomic site, if you haven’t registered with the wiki yet.

Oracular rufio:

08-02-2007 06:16:41 UTC

I did register, and logged in, and it occasionally seems to remember this, and if I edit the page, it remembers the edits I made, but it rarely does so when I’m not editing.

Elias IX:

08-02-2007 06:30:19 UTC

Okay, click, click, and check the box, respectively:

1. Preferences
2. Misc settings
3. Disable page caching

Oracular rufio:

08-02-2007 06:35:46 UTC

Ok, my browser does not have this particular collection of options, but I cleared the cache and it seems to work now.

Icarus:

08-02-2007 06:47:40 UTC

Talk about complicated. Climbing monkeys does sound more likely than dancing monkeys, though. Just one thing, how does one get ‘In the Tree’?
Anyway, I vote for.

Elias IX:

08-02-2007 06:54:32 UTC

My mistake, those instructions are for the wiki; after you log in, the preferences link is accessible from the top of the page.

Oracular rufio:

08-02-2007 06:57:53 UTC

Icarus - it’s not a proposal yet.  If Clucky’s other proposal (or something like it) passes, than In the List/Barrel/Tree will be a Status that can be changed at will (if I understand correctly).

Elias - I see now.  I didn’t before because it wasn’t recognizing that I was logged in…

Icarus:

08-02-2007 08:01:24 UTC

Whoops, got a bit voting-happy there. It’s so good I wanted to get my vote in as soon as possible.

Clucky:

08-02-2007 11:28:20 UTC

Well, we need a way to refer to each tree spot by space (probably just use numbers. Root is one, its children are 2 and 3. 2’s children are 4 and 5 while 3’s children are 6 and 7…) Also, it seems to me that the tree could start being sorted by name, but dance moves could say, change ‘name’ to ‘Bananas’ and shuffle all the monkeys in the tree.

Oracular rufio:

08-02-2007 13:55:40 UTC

Other ways to refer to individual Nodes might be to number them as they’re added (but we’d have to track that) or to refer to the right and left turns required to get to them from the Root (e.g. Root’s children are R and L, and R’s children are RR and RL, etc.)

Maybe we could have it where there’s something (bananas?) on the Leaves, and when Monkeys move into the Leaves they get it.  Then it wouldn’t matter whether Monkeys moved right or left, but which Monkey got moved up and which didn’t.

But this would all come later.  I’ll write the tree itself up into a real proposal after my class this afternoon.