doesnt get to the main return line ever.
public class AStarPathfinding {
// Define a Tile class as in the previous example
public static List<Tile> findPath(Tile[][] tiles, int startX, int startY, int endX, int endY) {
Tile startTile = tiles[startX][startY];
Tile endTile = tiles[endX][endY];
PriorityQueue<Tile> openSet = new PriorityQueue<>();
List<Tile> closedSet = new ArrayList<>();
startTile.gScore = 0;
openSet.add(startTile);
while (!openSet.isEmpty()) {
Tile currentTile = openSet.poll();
if (currentTile == endTile) {
List<Tile> path = new ArrayList<>();
while (currentTile != null) {
path.add(currentTile);
currentTile = currentTile.parent;
}
Collections.reverse(path);
return path;
}
closedSet.add(currentTile); ```