我不喜欢打字,所以我用一种非常简单的格式画迷宫:
# #####
# #
# ### #
# # # #
# # #
##### #
它不是迷宫吗?当然,我认为所有迷宫都应看起来像3d,与这个挑战相似但不相同,以最大程度地提高迷宫感,所以我(勉强地)手动更新了迷宫,使其看起来像这样:
+-----+ +-----------------------------+
|\ \ |\ \
+ \ \ + \ \
\ \ \ \ +-----------------------+ \
\ \ \ \| |\ \
\ \ \ +-----------------------+ \ \
\ \ \ +-----------------+ \ \ \
\ \ \ |\ \ \ \ \
\ \ \ + \ \ \ \ \
\ \ \ \ \ +-----+ \ \ \ \
\ \ \ \ \ \ |\ \ \ \ \
\ \ \ \ \ \---+ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \
\ \ +-----------------+ \ \ \ \
\ \ \ \ \ \
\ \ \ \ \ \
\ +-----------------------------+ \ +-----+
\| | \| |
+-----------------------------+ +-----+
不幸的是,使用这种格式的迷宫很难,而且毕竟手动输入后,我不想只重新输入原始内容,所以我需要您编写一个程序来为我做反转。
规则
- 输入将是仅由一个多行字符串或字符矩阵
" "
,"|"
,"\"
,"+"
,"-"
,和换行。 - 输出由
" "
和组成,"#"
采用迷宫描述的模式。 - 由于我出色的迷宫设计能力,您不能对迷宫的结构承担任何其他责任,除非这是有效的解构方法。
- 在3d化中(您现在必须撤消该过程),每个
#
都转换为以下3x4x7字符块:+-----+ |\ \ + \ \ \ +-----+ \| | +-----+
- 相邻的块连接在一起,如下所示:
但是没有连接线,所以实际上看起来像这样:+-----+-----+ |\ \ \ + \ \ \ \ +-----+-----+ \|\ \ \ + \ \ \ \ +-----+-----+ \| | | +-----+-----+
+-----------+ |\ \ + \ \ \ \ \ \ \ \ \ \ \ \ +-----------+ \| | +-----------+
- 凹形空间有时会阻塞其他墙壁的一部分。
+-----------+ |\ \ + \ \ \ \ +-----+ \ \ \ | \ \ \---+ \ +-----+ \| | +-----+
- 输入或输出中的尾随空格是可以接受的。(您必须指定答案是否要求输入中包含空格。)
- 前导空格必须与输入中的空白相对应。
- 我仍然不喜欢打字,所以最短的代码胜出
测试用例:
Input:
+-----+ +-----------------------------+
|\ \ |\ \
+ \ \ + \ \
\ \ \ \ +-----------------------+ \
\ \ \ \| |\ \
\ \ \ +-----------------------+ \ \
\ \ \ +-----------------+ \ \ \
\ \ \ |\ \ \ \ \
\ \ \ + \ \ \ \ \
\ \ \ \ \ +-----+ \ \ \ \
\ \ \ \ \ \ |\ \ \ \ \
\ \ \ \ \ \---+ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \
\ \ +-----------------+ \ \ \ \
\ \ \ \ \ \
\ \ \ \ \ \
\ +-----------------------------+ \ +-----+
\| | \| |
+-----------------------------+ +-----+
Output:
# #####
# #
# ### #
# # # #
# # #
##### #
Input:
+-----+
|\ \
+ \ \
\ +-----+
\| |
+-----+
Output:
#
Input:
+-----------------+
|\ \
+ \ \
+-----+ +-----+ +-----+
|\ \ |\ \
+ \ \---+ \ \
\ \ +-----+ \ +-----+ \
\ \ \ | \| |\ \
\ \ \---+ +-----+ \ \
\ \ +-----+ +-----+ \
\ \ \ |\ \
\ \ \ + \ \
\ +-----+ +-----+ +-----+
\| |\ \ |
+-----+ \ \---+
\ +-----------------+
\| |
+-----------------+
Output:
###
## ##
# #
## ##
###
Input:
+-----------------------------------------------------------------------------------------------------+
|\ \
+ \ \
\ +-----------------------------------------------+ +-----------------------------------------+ \
\| |\ \ |\ \
+-----------------------------------------------+ \ \---------------------------------------+ \ \
+-----+ +-----------------------------+ \ \ \ +-----------------------------+ \ \ \
|\ \ |\ \ \ \ \ |\ \ \ \ \
+ \ \ + \ \ \ \ \ + \ \ \ \ \
\ \ \ \ +-----------+ +-----+ \ \ \ \ \ +-----------------------+ \ \ \ \
\ \ \ \| |\ \ |\ \ \ \ \ \| |\ \ \ \ \
\ \ \ +-----------+ \ \---+ \ \ \ \ \ +-----------------------+ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \ \ \ +-----------------------+ \ \ \ \ \ \
\ \ \ |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ + \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ +-----+ \ \ \ \ \ \ \ +-----------------------------+ \ \ \ \ \ \
\ \ \ \| | \ \ \ \ \ \ \| | \ \ \ \ \ \
\ \ \ +-----+ \ \ \ \ \ \ +-----------------------------+ \ \ \ \ \ \
\ \ +-----------+ \ \ \ \ \ +-----------------------------------+ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ +-----------+ \ \ \ \ \ +-----------------------+ +-----+ \ \ \ \ \ \
\ \ \ | \ \ \ \ \ \ |\ \ | \ \ \ \ \ \
\ \ \---------+ \ \ \ \ \ \---------------------+ \ \---+ \ \ \ \ \ \
\ \ \ +-----------+ \ \ \ \ +-----------+ \ \ \ +-----+ \ \ +-----+
\ \ \ |\ \ \ \ \ |\ \ \ \ \ |\ \ \| |
\ \ \ + \ \ \ \ \ + \ \ \ \ \ + \ \ +-----+
\ \ \ \ +-----------------+ \ \ \ \ \ \ \ +-----+ \ +-----+ \
\ \ \ \| | \ \ \ \ \ \ \| | \| |\ \
\ \ \ +-----------------+ \ \ \ \ \ \ +-----+ +-----+ \ \
\ \ +-----------------------------+ +-----+ +-----------------------+ +-----------+
\ \ \
\ \ \
\ +-----------------------------------------------------------------------------------------------------+
\| |
+-----------------------------------------------------------------------------------------------------+
Output:
#################
# #
# ##### # ##### #
# # # # # #
# # # # ##### # #
# # # # #
### # ####### # #
# # # # # #
# ### # ## # ##
# # ## #
#################
Input:
+-----------------+
|\ \
+ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ \ \
\ +-----------------+
\| |
+-----------------+
Output:
###
###
###
Input: (Note leading whitespace)
+-----+ +-----+
|\ \ |\ \
+ \ \ + \ \
+-----+-----+-----+-----+
|\ \ |\ \ |
+ \ \---+ \ \---+
\ +-----+-----+-----+-----+
\| |\ \ |\ \
+-----+ \ \---+ \ \
+-----+-----+-----+-----+
|\ \ |\ \ |
+ \ \---+ \ \---+
\ +-----+ \ +-----+
\| | \| |
+-----+ +-----+
Output:
# #
# #
# #
# #