public class PacmanAStarTeleport implements Pacman {

    HashSet<Position> visited;
    PriorityQueue<Position> toVisit;
    HashMap<Position, Integer> cost;

    public PacmanAStarTeleport(PacmanState state) {
        visited = new HashSet<>();
        cost = new HashMap<>();
        Position food = state.findFoods().get(0);
        toVisit = new PriorityQueue<>((position, t1) ->
                Integer.compare(position.dist(food) + cost.get(position), t1.dist(food) + cost.get(t1)));
        cost.put(state.findPacman(), 0);
    }
}