The task
Given a folded and cut in places snowflake, "unwrap" it and output the result
Input
The base folded snowflake, without any cuts, looks like:
|\
| \
| \
| \
| \
| \
| \
| \
|________\
And the input will always resemble this. No changed or added symbols will go out of the range of this triangle, so
|\
| \
-| \
| \ o 0
| \
| \
| \.
| \
|________\
is not a valid input.
Possible changes and additions:
- Corner cuts
minimal cut:
_
| \
| \
| \
| \
| \
| \
|_ \
|_____/
Big, different cuts with cuts in them:
|\_/\
| \
| \
|___ \
_| _|
|___/
- Side cuts
minimal cuts, in random places on the sides:
|\
| \
| \
| |_
| \
\ \
/ \
| \
|____/\__\
Big, recursive cuts:
|\
| \
\ \
\|
/|
| | _
/ |_| \
| |\___ \
|_| \_\
And, of course, both types can be present at the same time.
Output
An "unfolded" snowflake. Here is an explanation of the unfold:
Say we have a snowflake
__
| \
| \
| \
\ \
/ \
| /
|______/
Which we will, for the explanation, remake as:
aa
1 1
2 2
3 3
b 4
b 5
1 c
2123456c
Where each uncut piece of sides is numbered from 1 to 9, and each cut has its own letter.
On the first unfold, you will get
123 12
a bb 1
aaa 2
1 3
2 4
3 5
b c
b c
1 c
2123456c
Which looks like
___ __
| \/ |
__| |
| |
| |
| |
\ /
/ /
| /
|_____/
Then, on the next unfold, we get:
123 1221 321
a bb bb a
aaa aaa
1 1
2 2
3 3
b cc b
b c c b
1 c c 1
2123456c c6543212
Which looks like
___ ____ ___
| \/ \/ |
__| |__
| |
| |
| |
\ /\ /
/ / \ \
| / \ |
|______/ \______|
If you would want another unfold, the scheme looks fine:
123 1221 321
a bb bb a
aaa aaa
1 1
2 2
3 3
b cc b
b c c b
1 c c 1
2 c c 2
2 c c 2
1 c c 1
b c c b
b cc b
3 3
2 2
1 1
aaa aaa
a bb bb a
123 1221 321
Until you actually make it in ascii:
___ ____ ___
| \/ \/ |
__| |__
| |
| |
| |
\ /\ /
/ / \ \
| / \ |
| / \ |
| \ / |
| \ / |
\ \ / /
/ \/ \
| |
| |
| |
__| |__
| /\ /\ |
___ ____ ___
So, for this challenge, I have chosen not to go for another unfold.
Here is another example on one of the snowflakes, without the scheme:
|\
| \
| \
| \
\ \
/ \
| \
| /\ \
|_/ \__/
Then, on the first unfold turns to:
____ ____
| \/ |
| /
| /
| \
\ \
/ |
| |
| /\ /
|_/ \__/
And then:
____ ________ ____
| \/ \/ |
| /\ |
| / \ |
| \ / |
\ \/ /
/ \
| |
| /\ /\ |
|_/ \__________/ \_|
Notice how, on the first unfold, the bottom side of the triangle translates to the right side of the square and, the same, with the left and top side.
Output
The final result, so
____ ________ ____
| \/ \/ |
| /\ |
| / \ |
| \ / |
\ \/ /
/ \
| |
| /\ /\ |
|_/ \__________/ \_|
for the example.
This is code-golf, so lowest byte-count wins!
123456
, but the unfolded right edge has only12345
. Where does the6
go? \$\endgroup\$|
become four top-right_
after the first unfold? \$\endgroup\$_
at the bottom have become three_
from the first to second unfold. \$\endgroup\$