I have a NxN table, let's say 5 times 5, in which given a point A at random position and unknown number of point Bs:
+---+---+---+---+---+
| B | | | | |
+---+---+---+---+---+
| | A | | | B |
+---+---+---+---+---+
| | | B | | |
+---+---+---+---+---+
| | | | B | |
+---+---+---+---+---+
| B | | | B | |
+---+---+---+---+---+
From point A, is there any way to find the shortest way to pass through all points B?
The same question has been asked here and I've done several researches about the travelling salesman problem. However, the approach to the solution on graph and on a table-like is different, as I can't determine the length between 2 slots, and on this table-like graph, A can only move up/down/left/right. Also, wiki doesn't break down to details of how the algorithm works or how to translate it into programming rather than Math operations all the way. I am stuck and not sure where to move on now. Any advice is high appreciated. Please suggest me some solutions.
EDIT: Adrian Wragg suggested me to draw lines as distance, so 1 problem is done. I'm not sure how to solve the problem to exact steps, because all the resources I found (even in my language) is about theory with Math symbols. Too far to my knowledge.
Tim.