diff --git a/src/resonantinduction/contractor/Pathfinding.java b/src/resonantinduction/contractor/Pathfinding.java index 1cc64e66c..4fcf6d9f3 100644 --- a/src/resonantinduction/contractor/Pathfinding.java +++ b/src/resonantinduction/contractor/Pathfinding.java @@ -3,11 +3,61 @@ */ package resonantinduction.contractor; +import java.util.HashMap; +import java.util.Set; + +import resonantinduction.base.Vector3; + /** + * Uses the well known A* Pathfinding algorithm. + * * @author Calclavia - * + * */ public class Pathfinding { + public Set openSet; + public HashMap navMap; + + public HashMap gScore, fScore; + + public Vector3 target; + + public Pathfinding(Vector3 target) + { + this.target = target; + } + + public void findNodes(Vector3 start) + { + this.openSet.add(start); + this.gScore.put(start, 0); + this.fScore.put(start, this.gScore.get(start) + getEstimate(start, this.target)); + + while (!this.openSet.isEmpty()) + { + Vector3 currentNode = null; + double lowestFScore = 0; + + for (Vector3 node : this.openSet) + { + if (currentNode == null || this.fScore.get(node) < lowestFScore) + { + currentNode = node; + lowestFScore = this.fScore.get(node); + } + } + + if (currentNode == null) + { + break; + } + } + } + + private double getEstimate(Vector3 start, Vector3 target2) + { + return null; + } }