summaryrefslogtreecommitdiff
path: root/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs
diff options
context:
space:
mode:
authorSimon O'Shea <osheas1@wit.edu>2023-08-08 16:29:52 -0400
committerSimon O'Shea <osheas1@wit.edu>2023-08-08 16:29:52 -0400
commit2dcb6ea96d73b29ddd5d6fd302330a004348c47d (patch)
tree1f70f088252202ccafae09ea425d518dc989d21a /Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs
parent239f7ed4c592fc90ad8d6afc9e342a0e8f1694cf (diff)
things are broken
Diffstat (limited to 'Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs')
-rw-r--r--Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs
new file mode 100644
index 0000000..6410626
--- /dev/null
+++ b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs
@@ -0,0 +1,53 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Pathfinder : MonoBehaviour
+{
+
+ // used to store all unique states that agent has visited (holds agent and sample coords)
+ public static List<State> closed = new List<State>();
+
+ LogicGrid world;
+ public static int[] agent;
+ public static List<int[][]> obstacles;
+ public static List<int[][]> samples;
+
+ public static int algorithm; // 0 = A* | 1 = dfs | 2 = bfs
+ public static int heuristic; // 0 = h0 | 1 = h1 | 2 = h2
+
+ public static int height;
+ public static int width;
+
+
+ public Pathfinder(LogicGrid world, int[] a, List<int[][]> o, List<int[][]> s, int algo, int heu)
+ {
+ this.world = world;
+ height = world.GetHeight();
+ width = world.GetWidth();
+
+ agent = a;
+ obstacles = o;
+ samples = s;
+
+ algorithm = algo;
+ heuristic = heu;
+ }
+
+ public void go()
+ {
+
+ Debug.Log("Agent: " + agent[0] + "," + agent[1]);
+
+ for(int i = 0; i < obstacles.Count; i++)
+ {
+ Debug.Log("Obstacle " + i + ": " + obstacles[i][0][0] + ", " + obstacles[i][0][1]);
+ }
+
+ for (int i = 0; i < samples.Count; i++)
+ {
+ Debug.Log("Sample " + i + ": " + samples[i][0][0] + ", " + samples[i][0][1]);
+ }
+
+ }
+}