algorithm - How to guarantee that all open nodes are traversable -
algorithm - How to guarantee that all open nodes are traversable -
in project, i'm using a* finding paths. first set downwards agent. place of blockers on nodes free. the agent needs able open node. however, next situation can happen:
a = agent b = node that's blocked x = open node that's impossible reach [a] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [b] [b] [ ] [ ] [ ] [x] [b] [ ] [ ] [ ]
here questions answered in order avoid situation (answering either 1 solve problem):
how can observe there no path x , prepare in best possible way (or @ to the lowest degree acceptable way won't require calling a* every node, randomly picking different node set 1 of blockers on until of nodes traversable)? when placing blockers, how can ensure won't create open node impossible reach?one way can think of place blockers. check neighbors see if neighbour nodes open , can traversed calling a* them. that's @ to the lowest degree little bit improve way explained possible solution in question 1.
there several ways generate mazes. simplest 1 randomized depth-first search(starting start cell , visiting unvisited neighbors in random order until exit reached. unvisited cells considered walls). has required properties(the exit reachable due termination condition, open cells reachable start cell because generates 1 connected component). can read more it(and few other maze generation algorithms) here: http://en.m.wikipedia.org/wiki/maze_generation_algorithm.
algorithm graph-algorithm path-finding a-star
Comments
Post a Comment