Simple A* algorithm written in Ruby