4 ms·
It's not clear to me whether the tree is mapping the paths of the maze or the walls - the transformation makes it appear as though the walls are being mapped bu
by roberthahn 12y ago
It's not clear to me whether the tree is mapping the paths of the maze or the walls - the transformation makes it appear as though the walls are being mapped but that doesn't make sense.
I wonder if this works backwards - given a tree could you construct a maze? efficiently?
- mbostock 12y agoIt’s the paths. You can see another example of a maze here: http://bl.ocks.org/mbostock/11357811 http://bl.ocks.org/mbostock/11357811 I made the paths thin (1px instead of 4px) to make it easier to see the tree on top of the maze. But to avoid the path/wall ambiguity, maybe it’d be better to start the paths 4px wide, transition to 1px, and then transition to the tree layout…
- roberthahn 12y agoOh hey, mbostock - you did some good work! Thanks for sharing. Your idea sounds fantastic - the problem really was with how I perceived the maze (black paths, white walls)
- sinaa 12y agoGreat work Mike. It would be great if you could add more comments to the code, or a simple separate guide for each of the projects. They are all amazing, and I'm sure many would want to learn more.
- yaph 12y agoCheck out this page http://bost.ocks.org/mike/ http://bost.ocks.org/mike/ if you haven't yet, there are several in-depth posts on how to do things with D3, also read the fantastic D3 docs. I guess making a guide for every Gist Mike posts would be quite demanding regarding his output, in the end even his day only 24 has hours.
- yayadarsh 12y agoIncredible work here! Really love this stuff.
- albertyw 12y agoInvert the colors - white is paths, black is walls.
- TophWells 12y ago>I wonder if this works backwards - given a tree could you construct a maze? efficiently? There are trees for which no rectangular maze exists - for example, any tree with a vertex of degree greater than 4. Or the tree with 4 vertices arranged in a T, which can't be fit into a 2x2 space. If there is such an algorithm, it'll have to account for the possibility that there is no solution, so I wouldn't expect it to be very efficient.