Shortest Path Algorithm in (Turbo)Pascal? - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: General (http://qbasicnews.com/newforum/forum-6.html) +--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html) +--- Thread: Shortest Path Algorithm in (Turbo)Pascal? (/thread-1339.html) Pages:
1
2
|
Shortest Path Algorithm in (Turbo)Pascal? - aardvark - 06-27-2003 I am using Borland TurboPascal 7.0 (not that it really makes any difference), and, being extrememly poor at maths, have no idea how to write a shortest-path algorithm for a 2D tiley-type game. Does anyone have a good tutorial or function or procedure (prefferably one I can just pump a few numbers into and have it spit some out) to do this? It *shudders*... it... needs trigonometry, doesn't it? Damn those ancient Greeks.... DAMN THEM ALL TO HELL![/i] Shortest Path Algorithm in (Turbo)Pascal? - Agamemnus - 06-27-2003 http://forum.qbasicnews.com/viewtopic.php?t=2872 No math. It isn't perfect, though. (if the target constantly changes, it's better just to move once and not calculate the whole move) If you want, I can upload the gif I made for this.. Shortest Path Algorithm in (Turbo)Pascal? - aardvark - 06-27-2003 ... :o That smiley does not accurately express my exhasperation at the weirdness and futility of me attempting to understand that article. Shortest Path Algorithm in (Turbo)Pascal? - Agamemnus - 06-27-2003 just read through it, slowly.. seriously. or, if you're online, I'll attempt to communicate. Shortest Path Algorithm in (Turbo)Pascal? - aardvark - 06-28-2003 Thanks loads EDIT: I have just realised a fundamental flaw in my question; I am looking for a straight line algorithm, not a shortest-path one. Shortest Path Algorithm in (Turbo)Pascal? - Agamemnus - 06-28-2003 well, what exactly are you trying to solve? a straight line's length can be determined by 2 points x1-x2 and y1-y2... So if you have something that wants to go straight, have it alternate in x and y. first, it goes in x direction, then in y, and so on... until it went enough in both directions. Shortest Path Algorithm in (Turbo)Pascal? - aardvark - 06-28-2003 OK, restating: I want to be able to determine one (1), a single, one-and-only, non-curving, shortest-path-between-2-points LINE.[/code] Shortest Path Algorithm in (Turbo)Pascal? - Agamemnus - 06-28-2003 yeah, but are you trying to draw the line? or what? Shortest Path Algorithm in (Turbo)Pascal? - aardvark - 07-01-2003 I have ye olde text mode 80*25 ASCII thingy, and want to be able to determine a straight line between two points, say, I have the player: "@", and a rat, "r". Code: ........r. Now, if the player shoots an arrow at the rat, I want to be able to determine how it gets there...[/code] Shortest Path Algorithm in (Turbo)Pascal? - relsoft - 07-01-2003 Here: All vars with P=Player, R=Rat Code: cls |