A* algorithm to eight program