still trying to fix astar
This commit is contained in:
@@ -99,6 +99,7 @@ using UnityEngine;
|
||||
onSample = CanSample();
|
||||
if (onSample.x == 1)
|
||||
{
|
||||
Debug.Log("SAMPLING");
|
||||
Node child = new Node(this, this.agent, this.samples, 'S', this.distanceTraveled + 1, this.heuristic);
|
||||
|
||||
child.samples.RemoveAt(onSample.y);
|
||||
|
||||
@@ -67,6 +67,7 @@ public class Pathfinder
|
||||
for(int i = 0; i < result.Count; i++)
|
||||
{
|
||||
Node n = result[i];
|
||||
Debug.Log("Agent at: " + n.agent.x + ", " + n.agent.y);
|
||||
Debug.Log(n.lastMove);
|
||||
}
|
||||
}
|
||||
@@ -79,9 +80,6 @@ public class Pathfinder
|
||||
List<Node> open = new List<Node>();
|
||||
|
||||
|
||||
|
||||
//PriorityQueue<Node> open = new PriorityQueue<Node>();
|
||||
|
||||
open.Add(initialState);
|
||||
int cap = 1000;
|
||||
while (true && cap > 0)
|
||||
@@ -100,7 +98,6 @@ public class Pathfinder
|
||||
{
|
||||
while (currentNode.parent != null)
|
||||
{
|
||||
Debug.Log("Agent at: " + currentNode.agent.x + ", " + currentNode.agent.y);
|
||||
solution.Add(currentNode);
|
||||
currentNode = currentNode.parent;
|
||||
}
|
||||
@@ -139,7 +136,7 @@ public class Pathfinder
|
||||
sorted.Add(children[i]);
|
||||
}
|
||||
|
||||
sorted = sorted.OrderBy(Node => Node.fn).ToList();
|
||||
//sorted = sorted.OrderBy(Node => Node.fn).ToList();
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user