I don't like typing, so I draw my mazes in a very simple format:
# #####
# #
# ### #
# # # #
# # #
##### #
Isn't it a-maze-ing? Of course, I think all mazes should look 3d, similar but not he same as this challenge, for maximum a-maze-ingness, so I (grudgingly) manually updated the maze to look like this:
+-----+ +-----------------------------+
|\ \ |\ \
+ \ \ + \ \
\ \ \ \ +-----------------------+ \
\ \ \ \| |\ \
\ \ \ +-----------------------+ \ \
\ \ \ +-----------------+ \ \ \
\ \ \ |\ \ \ \ \
\ \ \ + \ \ \ \ \
\ \ \ \ \ +-----+ \ \ \ \
\ \ \ \ \ \ |\ \ \ \ \
\ \ \ \ \ \---+ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \
\ \ +-----------------+ \ \ \ \
\ \ \ \ \ \
\ \ \ \ \ \
\ +-----------------------------+ \ +-----+
\| | \| |
+-----------------------------+ +-----+
Unfortunately, it's difficult to work with mazes in that format, and after all that manual typing, I don't want to just retype the original, so I need you to write a program to do the reversal for me.
Rules
- Input will be a multiline string or character matrix consisting only of
" "
,"|"
,"\"
,"+"
,"-"
, and newlines. - Output consists of
" "
and"#"
, in the pattern described by the maze. - Due to my amazing maze designing skills, you can assume nothing about the structure of the maze, other than that is has a valid deconstruction.
- In the 3d-ification, (the process you must now undo,) each
#
was converted to this 3x4x7 character block:+-----+ |\ \ + \ \ \ +-----+ \| | +-----+
- Adjacent blocks were joined together, like this:
but without joining lines, so it actually looks like this:+-----+-----+ |\ \ \ + \ \ \ \ +-----+-----+ \|\ \ \ + \ \ \ \ +-----+-----+ \| | | +-----+-----+
+-----------+ |\ \ + \ \ \ \ \ \ \ \ \ \ \ \ +-----------+ \| | +-----------+
- Concave spaces sometimes block parts of other walls.
+-----------+ |\ \ + \ \ \ \ +-----+ \ \ \ | \ \ \---+ \ +-----+ \| | +-----+
- Trailing whitespace in the input or output is acceptable. (You must specify if your answer requires trailing whitespace in the input.)
- Leading whitespace must correspond to empty spaces in the input.
- I still don't like typing, so shortest code wins
Test cases:
Input:
+-----+ +-----------------------------+
|\ \ |\ \
+ \ \ + \ \
\ \ \ \ +-----------------------+ \
\ \ \ \| |\ \
\ \ \ +-----------------------+ \ \
\ \ \ +-----------------+ \ \ \
\ \ \ |\ \ \ \ \
\ \ \ + \ \ \ \ \
\ \ \ \ \ +-----+ \ \ \ \
\ \ \ \ \ \ |\ \ \ \ \
\ \ \ \ \ \---+ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \
\ \ +-----------------+ \ \ \ \
\ \ \ \ \ \
\ \ \ \ \ \
\ +-----------------------------+ \ +-----+
\| | \| |
+-----------------------------+ +-----+
Output:
# #####
# #
# ### #
# # # #
# # #
##### #
Input:
+-----+
|\ \
+ \ \
\ +-----+
\| |
+-----+
Output:
#
Input:
+-----------------+
|\ \
+ \ \
+-----+ +-----+ +-----+
|\ \ |\ \
+ \ \---+ \ \
\ \ +-----+ \ +-----+ \
\ \ \ | \| |\ \
\ \ \---+ +-----+ \ \
\ \ +-----+ +-----+ \
\ \ \ |\ \
\ \ \ + \ \
\ +-----+ +-----+ +-----+
\| |\ \ |
+-----+ \ \---+
\ +-----------------+
\| |
+-----------------+
Output:
###
## ##
# #
## ##
###
Input:
+-----------------------------------------------------------------------------------------------------+
|\ \
+ \ \
\ +-----------------------------------------------+ +-----------------------------------------+ \
\| |\ \ |\ \
+-----------------------------------------------+ \ \---------------------------------------+ \ \
+-----+ +-----------------------------+ \ \ \ +-----------------------------+ \ \ \
|\ \ |\ \ \ \ \ |\ \ \ \ \
+ \ \ + \ \ \ \ \ + \ \ \ \ \
\ \ \ \ +-----------+ +-----+ \ \ \ \ \ +-----------------------+ \ \ \ \
\ \ \ \| |\ \ |\ \ \ \ \ \| |\ \ \ \ \
\ \ \ +-----------+ \ \---+ \ \ \ \ \ +-----------------------+ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \ \ \ +-----------------------+ \ \ \ \ \ \
\ \ \ |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ + \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \ \ +-----------------------------+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \ +-----------------------------+ \ \ \ \ \ \
\ \ +-----------+ \ \ \ \ \ +-----------------------------------+ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ +-----------+ \ \ \ \ \ +-----------------------+ +-----+ \ \ \ \ \ \
\ \ \ | \ \ \ \ \ \ |\ \ | \ \ \ \ \ \
\ \ \---------+ \ \ \ \ \ \---------------------+ \ \---+ \ \ \ \ \ \
\ \ \ +-----------+ \ \ \ \ +-----------+ \ \ \ +-----+ \ \ +-----+
\ \ \ |\ \ \ \ \ |\ \ \ \ \ |\ \ \| |
\ \ \ + \ \ \ \ \ + \ \ \ \ \ + \ \ +-----+
\ \ \ \ +-----------------+ \ \ \ \ \ \ \ +-----+ \ +-----+ \
\ \ \ \| | \ \ \ \ \ \ \| | \| |\ \
\ \ \ +-----------------+ \ \ \ \ \ \ +-----+ +-----+ \ \
\ \ +-----------------------------+ +-----+ +-----------------------+ +-----------+
\ \ \
\ \ \
\ +-----------------------------------------------------------------------------------------------------+
\| |
+-----------------------------------------------------------------------------------------------------+
Output:
#################
# #
# ##### # ##### #
# # # # # #
# # # # ##### # #
# # # # #
### # ####### # #
# # # # # #
# ### # ## # ##
# # ## #
#################
Input:
+-----------------+
|\ \
+ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ +-----------------+
\| |
+-----------------+
Output:
###
###
###
Input: (Note leading whitespace)
+-----+ +-----+
|\ \ |\ \
+ \ \ + \ \
+-----+-----+-----+-----+
|\ \ |\ \ |
+ \ \---+ \ \---+
\ +-----+-----+-----+-----+
\| |\ \ |\ \
+-----+ \ \---+ \ \
+-----+-----+-----+-----+
|\ \ |\ \ |
+ \ \---+ \ \---+
\ +-----+ \ +-----+
\| | \| |
+-----+ +-----+
Output:
# #
# #
# #
# #