Friday, 15 January 2010

c# - (A*) Pathfinding -



c# - (A*) Pathfinding -

(a*) pathfinding

only up,down,left,right

anyways, i'm not sure, i've checked examples, but, this?:

point starttile; point endtile; list<point> checkedpoints; list<point> uncheckedpoints;

so, add together starttile uncheckedpoints.

i'll cycle through uncheckedpoints, , add together (up, down, left, right) tiles uncheckedpoints, if it's not in checkedpoints. , remove point checked, , add together checkedpoints.

i'll same until endtile in uncheckedpoints, what?

1 if can't endtile, cycle on forever? how can prevent this?

2 if can't endtile, there way closest tile endtile?

3 how can list of tiles starttile endtile? keeping long list each cycle take loads of memory, right?

1 if can't endtile, cycle on forever? how can prevent this?

no, algorithm should run, long there uncheckedpoints. can abort, 1 time reachs endtile, not necessary.

and must never add together point uncheckedpoints contained in checkedpoints

2 if can't endtile, there way closest tile endtile?

yes, since store visited ppints in checkedpoints, can take closest point among them.

3 how can list of tiles starttile endtile? keeping long list each cycle take loads of memory, right?

you can store each point, point visited.

this double needed memory, not "loads of memory", since have store visited points anyways, avoid running in loops.

--

you might want @ dijkstra's algorithm on grid (not on graph), simpler. a* optimization not explore titles in kind of random order, first explore titles closest end tile.

c# .net path-finding

No comments:

Post a Comment