http://en.wikipedia.org/wiki/A*_search_algorithm same as v1 but without diagonal movement, with a target position