Skeleton code for the AStar algorithm.