From cd15c103c6f1113461ead6065e47130276cb61a1 Mon Sep 17 00:00:00 2001 From: Simon O'Shea Date: Wed, 9 Aug 2023 09:37:44 -0400 Subject: astar is animated primitively --- .../Assets/Scripts/Pathfinder.cs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs') diff --git a/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs index 3085868..556abdb 100644 --- a/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs +++ b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs @@ -21,12 +21,12 @@ public class Pathfinder public static int height; public static int width; - public static Stack result; + public Stack result; public Pathfinder(LogicGrid world, Vector2Int a, List o, List s, int algo, int heu) { - this.world = world; + this.world = world; height = world.GetHeight(); width = world.GetWidth(); @@ -39,9 +39,6 @@ public class Pathfinder //printInfo(); - - - StartWork(); } @@ -69,21 +66,14 @@ public class Pathfinder if (algorithm == 0) { result = StartAStar(initialState); - Debug.Log(" "); - - int count = result.Count; - for(int i = 0; i < count; i++) - { - Node n = result.Pop(); - Debug.Log("Agent at: " + n.agent.x + ", " + n.agent.y); - Debug.Log(n.lastMove); - } } } public static Stack StartAStar(Node initialState) { - Stack solution = new Stack(); + Debug.Log("GO!"); + + Stack solution = new Stack(); List open = new List(); @@ -105,6 +95,7 @@ public class Pathfinder if (currentNode.samples.Count() == 0) { Debug.Log("Gottem"); + //Node n = FindLastSample(open); @@ -299,7 +290,6 @@ public class Node 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); -- cgit v1.3.1-4-g156e