Worked on A*. Something's wrong, it needs work. The smallest distance seems to work. Maybe it's the matrix traversal.