A star algorithm to find path