Advertisement

A* and c++

Started by May 16, 2005 10:51 PM
3 comments, last by frecco2k 19 years, 9 months ago
I need just a snippet of code and what I can apply this ai approach to such as pac man , I am just learning A* pathfinding
A quick google search of astar c++ source comes up with quite a few implementations.

For a game like PacMan, you would build a connectivity graph of all the intersections, give it the point you are at and the point you are interested in, then run the algorithm. If you aren't familiar with the algorithm, Game Programming Gems 1 covers the algorithm pretty well.

frob.
Advertisement
The actual AI of Pac Man has nothing to do with A*, though.
enum Bool { True, False, FileNotFound };
Quote:
Original post by hplus0603
The actual AI of Pac Man has nothing to do with A*, though.


Yep... there have been several good expositions of how the AI in Pacman worked posted within this forum. Search the forum archives and you should find them without much effort! If you just want to learn A*, just restrict yourself to finding a simple path in a 'grid world'. Start with no obstacles to ensure that you have the algorithm working properly, then add static obstacles. Finally you can deal with dynamic obstacles, which will require you to extend the algorithm beyond what would be classed as 'A*'.
this tutorial seems kindoff pacmanish http://www.geocities.com/jheyesjones/astar.html
----------------------------"I refuse to answer that question on the grounds that I don't know the answer"-- Douglas Adams (1952 - 2001)

This topic is closed to new replies.

Advertisement