Computer Science Canada [source] BFS pathfinding algorithm |
Author: | zylum [ Sat Oct 15, 2005 10:19 pm ] |
Post subject: | [source] BFS pathfinding algorithm |
i thought this would come in handy to people making games. Its a breath first search pathfindign algorithm which returns an array of points. these points is the best path from finish to start (yeah i know, its inconvenient but thats how the algo works). If there is no path then the elements all contain the point (0,0) If you are having trouble figuring out how this works, first read my tutorial on recursion, then ask any further questions you have. |
Author: | zylum [ Wed Oct 19, 2005 8:51 pm ] |
Post subject: | |
ok so since nobody like the first verion, i uploaded v2.. its now an easy to use class... it exports things: hasMoreMoves - is a boolean which returns true if there are more moves remaining in the path nextMove - returns the next move in the path as a point (Coords type). you should only use this IFF hasMoreMoves is true findPath - finds the path from start to finish. |
Author: | Aziz [ Thu Dec 01, 2005 8:25 pm ] |
Post subject: | |
Um, I got an HTML document when I downloaded this... |
Author: | zylum [ Thu Dec 01, 2005 11:35 pm ] | ||
Post subject: | |||
have fun |
Author: | Dan [ Thu Dec 01, 2005 11:40 pm ] |
Post subject: | |
Unforntly that file seems to be missing form our server. I am unshure as to why. Maybe zylum could be conviced to reupload it? Edit: nvm about that last part =p, thx zylum |
Author: | Aziz [ Sat Dec 03, 2005 5:35 pm ] |
Post subject: | |
There's been way to much time spent on this for me. I need to finish this up simply (probably take the rest of the night anyways) and get to work my other projects (2 big ones) so I'm going to leave this to the kind soul to solve... I've uploaded my pacman and the PathFinder class I've made out of mutated zylum's. See, my game is working in (ROW,COL) instead of (X,Y) and i was trying to convert it around. It's the red ghost that I'm trying to get to follow P-man. But it never finds a path. I'm going to stick with a wandering pattern, but thanks for all the help guys. |
Author: | jrblast [ Mon Dec 12, 2005 11:39 pm ] |
Post subject: | |
Thats some really cool stuff man, good job. |