]> Dogcows Code - chaz/carfire/commitdiff
path finder now actually uses the heuristic and cost functions passed
authorCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Tue, 20 Apr 2010 01:44:29 +0000 (01:44 +0000)
committerCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Tue, 20 Apr 2010 01:44:29 +0000 (01:44 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@121 92bb83a3-7c8f-8a45-bc97-515c4e399668

CarFire/CarFire/CarFire/PathFinder.cs
CarFire/CarFire/CarFire/PriorityQueue.cs

index 8b627ace0bed4f8500132ee33da9b6540615940b..91724384ab2ac4cccca98b2c830b66c0bff2c1e7 100644 (file)
@@ -112,7 +112,7 @@ namespace CarFire
             mFringe = new BinaryHeap<Cell>();\r
             mCells = new Cell[mGridWidth, mGridHeight];\r
 \r
-            Cell startCell = new Cell(start, 0, GetManhattanDistance(start, finish));\r
+            Cell startCell = new Cell(start, 0, heuristic(start, finish));\r
             mFringe.Add(startCell);\r
             mCells[start.X, start.Y] = startCell;\r
             while (mFringe.Count > 0)\r
@@ -151,11 +151,11 @@ namespace CarFire
                     if (0 <= point.X && point.X < mGridWidth && 0 <= point.Y && point.Y < mGridHeight &&\r
                         mGrid[point.X, point.Y])\r
                     {\r
-                        int cost = cell.G + GetCost(cell.Point, point);\r
+                        int cost = cell.G + costFunction(cell.Point, point);\r
 \r
                         if (inQueue == null)\r
                         {\r
-                            Cell neighbor = new Cell(point, cost, GetManhattanDistance(point, finish), cell);\r
+                            Cell neighbor = new Cell(point, cost, heuristic(point, finish), cell);\r
                             mFringe.Add(neighbor);\r
                             mCells[point.X, point.Y] = neighbor;\r
                         }\r
index df60ec0e6f35eb19b0f329913d6bd5c08403a3a8..9a1fc574d7b63374acad1cbc5867cfc4afb3829d 100644 (file)
@@ -340,7 +340,7 @@ namespace CarFire
         #region Private Methods\r
 \r
         // Builds up the binomial trees.  More importantly, it sets the min\r
-        // pointeer and ensures that no root binomial tree has the same degree.\r
+        // pointer and ensures that no root binomial tree has the same degree.\r
         void Consolidate()\r
         {\r
             LinkedListNode<NodeInfo>[] degree = new LinkedListNode<NodeInfo>[64];\r
This page took 0.02362 seconds and 4 git commands to generate.