ðTиDU'|TиX'BŽ5ES©ǝX„\/TbSDVè®ǝ€ºX4×"HOV3"®ǝX'<18SǝX„|-Yè®ǝøJDí'<'>:X'^®ǝ2×'#Tи2×'x5и'|5и«'!Tи)I.•o¤[‹‡•uŽDýSтì€ûŽe1ª904ûª8ª₄«ª‡•δ~¬]•2ôDí«Ž
ÿT∍S:ð.ø8ðì‚8:1ðì‚ð:SðT:èεI∍}øJ»
相当糟糕的方法,但是它有效并且制作起来很有趣。当然,可以打更多的球。
+1个字节作为两个相邻HH
通道的错误修复。
在线尝试。
说明:
步骤1:建立大小为10的所有可能车道:
ðTи # Push a space character, repeated 10 times as list
DU # And store a copy in variable `X`
'|Tи '# Push "|", repeated 10 times as list
X # Push the list of spaces of variable `X`
'B '# Push a "B"
Ž5E # Push compressed integer 1289
S # Converted to a list of digits: [1,2,8,9]
© # Store it in variable `®` (without popping)
ǝ # Replace the spaces in the pushed `X` with the "B" at these (0-based)
# indices
X # Push `X` again
„\/ # Push string "\/"
TbS # Push 10, converted to binary, as list: [1,0,1,0]
DV # Store a copy in variable `Y`
è # Index each into this string: ["/","\","/","\"]
® # Push list `®` again ([1,2,8,9])
ǝ # And replace the spaces with these characters
€º # And then mirror each line (" "→" "; "/"→"/\"; "\"→"\/")
X # Push `X` again
4× # Extend each space to four spaces
"HOV3" # Push string "HOV3"
®ǝ # And replace the spaces with this string at the indices of `®` again
X # Push `X` again
'< '# Push string "<"
18S # Push 18 as list: [1,8]
ǝ # Replace the spaces with "<" at those indices
X # Push `X` yet again
„-| # Push string "-|"
Yè # Use list `Y` ([1,0,1,0]) to index into this string: ["-","|","-","|"]
®ǝ # And replace the spaces at the indices of `®` again
ø # Then zip-pair the two lists together
J # And join each pair of characters to a string
Dí # Create a copy and reverse each string
'<'>: # And replace all "<" with ">"
X'^®ǝ '# Push `X` with the spaces at indices `®` replaced with "^"
2× # Extend each character to size 2
'#Tи '# Push "#", repeated 10 times as list
2× # And extend each character to size 2
'x5и '# Push "x" repeated 5 times as list
'|5и '# Push "|" repeated 5 times as list
« # And merge the lists together
'!Tи '# Push "!", repeated 10 times as list
) # And finally wrap all lists of the stack into one big list of lanes
步骤2:将输入字符串转换为索引(我们将使用该索引将索引到在步骤1中创建的列表中):
I # Push the input-string
.•o¤[‹‡• # Push compressed string "tlrpbhmu"
u # And uppercase it
ŽDý # Push compressed integer 3567
S # Converted to a list of digits: [3,5,6,7]
тì # Prepend each with "100": ["1003","1005","1006","1007"]
€û # And palindromize each: ["1003001","1005001","1006001","1007001"]
Že1 # Push compressed integer 10201
ª # And append it to the list
904ûª # Push 904 palindromized to "90409", and also append it to the list
8ª # Append 8 to the list
₄Â # Push 1000, and bifurcate it (short for Duplicate & Reverse copy)
« # Merge them together: "10000001"
ª # And also append it to the list
‡ # Now transliterate all uppercase characters in the input to these numbers
•δ~¬]• # Push compressed integer 1119188999
2ô # Split into parts of size 2: [11,19,18,89,99]
Dí # Create a copy, and reverse each item: [11,91,81,98,99]
« # And merge the lists together: [11,19,18,89,99,11,91,81,98,99]
Ž\nÿ # Push compressed integer 19889
T∍ # Extended to size 10: 1988919889
S # As a list of digits: [1,9,8,8,9,1,9,8,8,9]
: # Replace all [11,19,18,89,99,11,91,81,98,99] with [1,9,8,8,9,1,9,8,8,9]
# in the converted string
ð.ø # Surround the string with spaces
8ðì # Push 8 with a prepended space: " 8"
‚ # Bifurcate and pair: [" 8","8 "]
8: # And replace all those for 8 in the string
1ðì‚ð: # Do the same for [" 1","1 "] → " "
S # Convert the string to a list of characters (digits and space)
ðT: # Replace the spaces for 10
步骤3:我们使用这些索引来索引车道列表。然后,我们将这些通道列表转换为正确的输出,包括将它们扩展/缩短为整数输入的大小:
è # Index the indices in the integer-list into the lanes-list
ε # Map over each lane
I # Push the second integer-input
∍ # Extend/shorten each 10-sized lane to this input-size
}ø # After the map: zip/transpose; swapping rows/columns
J # Join inner list together to a single string
» # And then join each string by newlines
# (after which the result is output implicitly)
看到这个05AB1E尖矿(部分如何压缩字符串不是字典的一部分吗?并且如何压缩大整数?)理解为什么Ž5E
是1289
; .•o¤[‹‡•
是"tlrpbhmu"
; ŽDý
是10201
; •δ~¬]•
是1119188999
; Ž\nÿ
是19889
。