in reply to Challenge: Dumping trees.
Done! Adapted from http://hectorcorrea.com/Blog/Drawing-a-Binary-Tree-in-Ruby, where descendents are called children :)
_____/\_____ ___________/\_ ___/\ _______________/\_ /\_ /\_ z ___/\_____ /\_____ t /\ w /\ _/\_ _/\___ n _/\_ u v x y _/\ /\ _/\ _/\_ _/\ /\ /\ c d e /\ h /\ /\_ /\ q r s a b f g i j k /\ o p l m
Naturally nodes with a width greater than 2 chars breaks it :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Challenge: Dumping trees.
by BrowserUk (Patriarch) on Oct 14, 2012 at 08:40 UTC | |
Naturally nodes with a width greater than 2 chars breaks it :) Thank you anonymonk. That handles everything I've thrown at it -- which it a darn sight more than I can say for my attempts so far. It occasionally produces an oddity -- see the 'wxyz' nodes in the second example and the '1' node in the last two examples -- but they are still clear enough for my purposes.
I'm going to try and adapt it to produce a slightly different style of output that I think results in nicer -- cleaner, more easily read -- output. Eg. Instead of:
This:
Also, one possibility for handling node 'names' of more than 1 or 2 chars; though I'm not sure it really works as is?:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
|
Re^2: Challenge: Dumping trees.
by BrowserUk (Patriarch) on Oct 15, 2012 at 14:16 UTC | |
Upon further testing, the anomalies I noted in Re^2: Challenge: Dumping trees. were actually more prevalent and distracting than I first thought; and I failed in my attempts to cure them in your code. I also finally succeeded in getting my attempt to work properly. In part, because of a couple of things I learnt from studying your code. Thank you. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
by Anonymous Monk on Oct 15, 2012 at 17:14 UTC | |
I also finally succeeded neat :) it really is much easier on the eyes Upon further testing, the anomalies Hmm, weird. Using your tree generator And runningI was not able to reproduce the anomalies, I get | [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Oct 15, 2012 at 20:58 UTC | |
I was not able to reproduce the anomalies, Okay. At that point, I manually made the simplest correction to the raw tree that (I thought) would make it valid: and re-ran the dumper. As you can see, it still produces the identical, malformed dump:
So then I fed that corrected tree to my dumper:
At this point, I'm kicking the ball into your court to decide if it is worth pursuing further? With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by Anonymous Monk on Oct 15, 2012 at 22:03 UTC | |