From: Charles Date: Tue, 20 Apr 2010 01:44:29 +0000 (+0000) Subject: path finder now actually uses the heuristic and cost functions passed X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=681f16a95c1c67bdd40ed16842a70f8e10ba31e1;p=chaz%2Fcarfire path finder now actually uses the heuristic and cost functions passed git-svn-id: https://bd85.net/svn/cs3505_group@121 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/PathFinder.cs b/CarFire/CarFire/CarFire/PathFinder.cs index 8b627ac..9172438 100644 --- a/CarFire/CarFire/CarFire/PathFinder.cs +++ b/CarFire/CarFire/CarFire/PathFinder.cs @@ -112,7 +112,7 @@ namespace CarFire mFringe = new BinaryHeap(); mCells = new Cell[mGridWidth, mGridHeight]; - Cell startCell = new Cell(start, 0, GetManhattanDistance(start, finish)); + Cell startCell = new Cell(start, 0, heuristic(start, finish)); mFringe.Add(startCell); mCells[start.X, start.Y] = startCell; while (mFringe.Count > 0) @@ -151,11 +151,11 @@ namespace CarFire if (0 <= point.X && point.X < mGridWidth && 0 <= point.Y && point.Y < mGridHeight && mGrid[point.X, point.Y]) { - int cost = cell.G + GetCost(cell.Point, point); + int cost = cell.G + costFunction(cell.Point, point); if (inQueue == null) { - Cell neighbor = new Cell(point, cost, GetManhattanDistance(point, finish), cell); + Cell neighbor = new Cell(point, cost, heuristic(point, finish), cell); mFringe.Add(neighbor); mCells[point.X, point.Y] = neighbor; } diff --git a/CarFire/CarFire/CarFire/PriorityQueue.cs b/CarFire/CarFire/CarFire/PriorityQueue.cs index df60ec0..9a1fc57 100644 --- a/CarFire/CarFire/CarFire/PriorityQueue.cs +++ b/CarFire/CarFire/CarFire/PriorityQueue.cs @@ -340,7 +340,7 @@ namespace CarFire #region Private Methods // Builds up the binomial trees. More importantly, it sets the min - // pointeer and ensures that no root binomial tree has the same degree. + // pointer and ensures that no root binomial tree has the same degree. void Consolidate() { LinkedListNode[] degree = new LinkedListNode[64];