05AB1E,137个 135 128 122 字节
…( )7ÝJ»•αγʒδÓ₂©8¥ŽQxΣxêÿ•12вèJIvN”</[(
._-=:"ÆŸ,*”º•DùÙÂ+;Èγтáì³ÓW©ÎÂ_`ƒ≠îj*ΓçÊ~ÞÒ¸β¦oåb/õ47/vÎΓ”›≠øØZµλݺ•20в趡Nè4äyè.;
-6个字节,感谢@Grimy。
在线尝试或验证更多测试用例。
说明:
我们首先创建模板字符串:
…( ) # Push string "( )"
7ÝJ # Push a list in the range [0,7] joined together: "01234567"
» # Join both by a newline: "( )\n01234567"
•αγʒδÓ₂©2°ćì₂òη₆½•
# Push compressed integer 80545642885242518310229085147411483894
12в # Convert it to Base-12 as list: [1,4,4,4,4,4,3,1,4,4,4,4,4,3,8,0,6,5,7,2,9,3,8,0,10,10,10,2,9,3,1,0,11,11,11,2]
è # Index each into the string: [" ","0","0","0","0","0","\n"," ","0","0","0","0","0","\n","4","(","2","1","3",")","5","\n","4","(","6","6","6",")","5","\n"," ","(","7","7","7",")"]
J # And join it to a single string: " 00000\n 00000\n4(213)5\n4(666)5\n (777)"
看起来像这样:
00000
00000
4(213)5
4(666)5
(777)
然后,我遍历输入的数字:
I # Get the input
v # Loop `y` over each of its digits:
并执行以下操作:
推送列表的(0索引)索引N
:
N # Push the index of the loop
将所有可能的部分作为字符列表的列表:
”</[(
._-=:"ÆŸ,*”
"# Push dictionary string "</[(\n._-=:" Oo,*"
º # Mirror each line: "</[()]\>\n._-=:" Oo,**,oO ":=-_."
•DùÙÂ+;Èγтáì³ÓW©ÎÂ_`ƒ≠îj*ΓçÊ~ÞÒ¸β¦oåb/õ47/vÎΓ”›≠øØZµλݺ•
# Push compressed integer 492049509496347122906361438631265789982480759119518961177677313610613993948059787418619722816092858096158180892708001681647316210
20в # Convert it to Base-20 as list: [15,10,10,10,15,3,10,19,10,4,15,15,15,15,15,10,12,12,12,10,15,10,10,10,15,9,9,9,9,9,15,15,10,15,15,15,1,10,6,15,8,15,18,9,10,8,11,9,17,16,8,11,9,17,16,8,15,15,15,0,6,15,15,1,8,15,15,15,7,1,15,15,6,8,15,15,15,15,13,15,5,15,2,7,15,0,8,15,15,15,15,13,15,14,15,14,10,10,10]
è # Index each into the string: [" ","_","_","_"," ","(","_","*","_",")"," "," "," "," "," ","_","=","=","=","_"," ","_","_","_"," ",".",".",".",".","."," "," ","_"," "," "," ","/","_","\"," ","\n"," ",",",".","_","\n","-",".","o","O","\n","-",".","o","O","\n"," "," "," ","<","\"," "," ","/","\n"," "," "," ",">","/"," "," ","\","\n"," "," "," "," ",":"," ","]"," ","[",">"," ","<","\n"," "," "," "," ",":"," ","""," ",""","_","_","_"]
¶¡ # Split it by the newline character: [[" ","_","_","_"," ","(","_","*","_",")"," "," "," "," "," ","_","=","=","=","_"," ","_","_","_"," ",".",".",".",".","."," "," ","_"," "," "," ","/","_","\"," "],[" ",",",".","_"],["-",".","o","O"],["-",".","o","O"],[" "," "," ","<","\"," "," ","/"],[" "," "," ",">","/"," "," ","\"],[" "," "," "," ",":"," ","]"," ","[",">"," ","<"],[" "," "," "," ",":"," ","""," ",""","_","_","_"]]
使用循环索引N
获取当前正在使用的零件的字符列表:
Nè # Index the loop index into it
# i.e. 6 → [" "," "," "," ",":"," ","]"," ","[",">"," ","<"]
然后将字符列表分成四个相等的部分,并使用输入数字y
(1索引)对其进行索引。(注意:由于05AB1E是0索引的,但输入是1索引的,因此在索引之前将数字减少1是合乎逻辑的。但是,由于05AB1E具有自动回绕功能(即3
,列表中的索引[1,3,5]
会导致1
),我只是旋转零件一次,因此挑战说明中的零件编号为4的零件位于列表的前面。)
4ä # Split it into 4 equal parts
# i.e. [[" "," "," "],[" ",":"," "],["]"," ","["],[">"," ","<"]]
yè # Index the input-digit `y` into it (with automatic wraparound)
# i.e. 4 → [" "," "," "]
然后,首先用部分字符替换我们首先推入的循环的0索引索引:
.; # Replace first; every index of the loop `N` in the template-string
# is replaced one by one with the characters
最后,结果将隐式输出。
请参阅我的05AB1E技巧(如何压缩大整数?和如何压缩整数列表?)以了解压缩部分的工作方式。
至于我最喜欢的,它仍然是1.5年前发布Java解决方案时的“雪兔”:
44114432:
_
(_*_)
(. .)
(> <)
(" ")