Introduction
I have a lot of ASCII rocks. They are built with dashes, pipes, Vs, carets, angle brackets, slashes and spaces. Example:
/--\
| |
| |
\--/
I want to erode them, like this:
/\
/ \
\ /
\/
All of the corners have become rounder. A more complicated example:
/----\
| \------\
| |
| |
\------------/
/--\
/ \------\
| \
\ /
\----------/
After another erosion, it would become
/\
/ \------\
< \
\ /
\--------/
And another:
/\------\
< \
\ /
\------/
Challenge
Your challenge is to write a program that can erode an input once. You can assume there is only one rock and you can assume it is one closed loop. The input will only contain the chars /\ -| <> ^V \n
and will have trailing spaces to create a rectangle. The program can either get input from STDIN and output to STDOUT or can be a function. At the end of each row is a newline character. The erosion must follow the rules outlined below (Note: in the examples the rock isn't completed, this is for ease of explanation). The output must be in the same format as the input, with the same size as the input. However, trailing spaces may be omitted.
The slashes will spread to pipelines and dashes and move across.
/---
|
|
/--
/
|
/-
/
/
If two slashes merge together, the appropriate character out of <>^V
is used.
/-----\
| |
| |
| |
\-----/
/---\
/ \
| |
\ /
\---/
/-\
/ \
< >
\ /
\-/
^
/ \
< >
\ /
V
If a part of the rock can merge, it will. Note: if one part can merge but the other can't (i.e, /\
in the second line of the example), then the one that can merge will (see example).
/\
/\-^-/\-/ \--
|
<
|
/
\
|
/
/
\
\
|
|
/-------/\--
/
|
|
|
|
|
|
/
\
|
|
|
Eventually, all rocks will become nothing.
<> ^ /\
V \/
Test cases
Test 1:
/----\
| \------\
| |
| |
\------------/
/--\
/ \------\
| \
\ /
\----------/
/\
/ \------\
< \
\ /
\--------/
/\------\
< \
\ /
\------/
/-----\
< \
\ /
\----/
/---\
< \
\ /
\--/
/-\
< \
\ /
\/
^
< \
\/
Test 2:
/----\
| |
| |
| |
| |
\----/
/--\
/ \
| |
| |
\ /
\--/
/\
/ \
/ \
\ /
\ /
\/
/\
/ \
\ /
\/
/\
\/
Test 3:
^ /\
/\--/\--/ \--/ \-\
\ |
| |
/ |
\ |
| |
| |
/ |
< |
\ |
| |
| |
/ |
/ |
\ |
\-----------------/
/-------^----/\-\
/ \
| |
| |
| |
| |
| |
| |
< |
| |
| |
| |
| |
/ |
\ /
\---------------/
/-------------\
/ \
/ \
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
\ /
\ /
\-------------/
/-----------\
/ \
/ \
/ \
| |
| |
| |
| |
| |
| |
| |
| |
\ /
\ /
\ /
\-----------/
/---------\
/ \
/ \
/ \
/ \
| |
| |
| |
| |
| |
| |
\ /
\ /
\ /
\ /
\---------/
/-------\
/ \
/ \
/ \
/ \
/ \
| |
| |
| |
| |
\ /
\ /
\ /
\ /
\ /
\-------/
/-----\
/ \
/ \
/ \
/ \
/ \
/ \
| |
| |
\ /
\ /
\ /
\ /
\ /
\ /
\-----/
/---\
/ \
/ \
/ \
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\ /
\ /
\ /
\---/
/-\
/ \
/ \
/ \
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\ /
\ /
\ /
\-/
^
/ \
/ \
/ \
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\ /
\ /
\ /
V
^
/ \
/ \
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\ /
\ /
V
^
/ \
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
\ /
V
^
/ \
/ \
/ \
/ \
\ /
\ /
\ /
\ /
V
^
/ \
/ \
/ \
\ /
\ /
\ /
V
^
/ \
/ \
\ /
\ /
V
^
/ \
\ /
V
^
V
Scoring
This is code-golf, so the program with the smallest number of bytes wins!
Standard loopholes are not allowed.
"\x20\x20\x20\x20\x20\x20/\\\n/-\\\x20\x20/\x20\x20\\-\\\n|\x20\x20\\/\x20\x20\x20\x20\x20|\n\\---------/\n"
\$\endgroup\$