python - Drawing mud map -


i'm trying draw map of mud. have used python , graphviz like:

http://img23.imageshack.us/img23/5222/arrasz.png

as can see have locations , going n/s/w/e/up/down going other location.

is possible, graphviz, draw map have north locations south, , east locations on right of west locations?

i mean that:

some        --- e --->   location   <--- w ---    location 2                             .                            / \   |                             |    |                              n    s                              |    |                                 \ /                                     `                           location 3 

or maybe there better tool draw automatically graphviz?

people have asked improving graphviz layout before, think graphviz overkill here.

if have standard mud layout this:

simple mud layout

...then you've got strong constraints rooms are. graphviz doesn't know constraints, won't job simple algorithm like:

  1. pick starting location on grid
  2. traverse through each room using e.g. depth-first traversal
  3. move 1 unit n, s, e, or w each new room

if don't want write visualization code, (perhaps) above approach pre-processing step graphviz, using way of assigning ranks each room. (hopefully) graphviz produce correct output.

edit: example, pseudocode:

visit(initialroom, 0, 0)  def visit(curroom, curx, cury)   if curroom == null return    print "in room " + curroom + " @ location " + curx + ", " + cury    visit(curroom.northneighbor, curx,   cury-1)   visit(curroom.southneighbor, curx,   cury+1)   visit(curroom.westneighbor,  curx-1, cury)   visit(curroom.eastneighbor,  curx+1, cury) 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -