Computer Science Canada A* and Floodfill algorithms |
Author: | Panphobia [ Sat Nov 17, 2012 12:38 am ] |
Post subject: | A* and Floodfill algorithms |
I was wondering if you guys could help me with these two algorithms, I have them searched on wikipedia, but I do not know how to implement them to my advantage. I know you can A* for this question http://dwite.org/questions/haunted_house.html , but i was wondering how I would implement it. Also for flood fill I know you can use it on this question http://dwite.org/questions/oil_spill_area.html , but I also wonder how to implement. If there are guides on this could you guys link me, if not could you explain it to me, preferably in python/java. |
Author: | Tony [ Sat Nov 17, 2012 1:25 am ] |
Post subject: | RE:A* and Floodfill algorithms |
A* is a heuristic. While in practice it might typically give correct results, it's not guaranteed to give the optimal result. http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm is typically the way to go if optimality must be guaranteed. A* is typically used when some optimality can be sacrificed to gain performance (such as in video games). Wikipedia's entry on Flood Fill http://en.wikipedia.org/wiki/Flood_fill also describes the algorithm in detail. |