You want to find the length shortest path between two points, on an 2d ASCII "map". The roads are made up of +
characters, and the two endpoints are represented by #
s (not counted in the length). This road can be arranged in any way, and any other characters can be ignored. You can assume the endpoints will always connect to each other through roads.
Examples:
Output: 1
#+#
Output: 5
#+
+ +
++++++
+
#
Output: 8
++++#+++
+ +
+ +
++#+++++
Output: 4
#+++
++++
+++#
Output: 42
+++++
+ +
+# +
+++#+
+
+++
Undefined output:
##
# +++#
+ +
#+++#
+
+
#
#++
+
Rules:
- You can take input as a 2d array, matrix, string separated by newlines, etc.
- Output should be a number
- Can be a snippet, function, or full program
- You can represent one endpoint with a different character if necessary