žGçU|€SXζζD"εγεDgDisëXи]"©.V˜sø®.V€Sø˜‚øʒË}ʒXå≠}gq
žGçU|€SXζζD"εγεDgDisëXи]"©.V˜sø®.V€Sø˜‚øʒË}ʒXå≠}gq
इसे ऑनलाइन आज़माएं।
यह मेरे द्वारा लिखे गए सबसे बदसूरत और सबसे लंबे 05AB1E कार्यक्रमों में से एक है।>> यह चुनौती 05AB1E में धोखा देने वाली कठिन है। मुझे कोई संदेह नहीं है कि बाइट-काउंट को अलग दृष्टिकोण (या समान दृष्टिकोण के साथ) का उपयोग करके कम से कम आधा या तीन से चार गुना छोटा किया जा सकता है, लेकिन मैं वर्तमान में नहीं देखता कि कैसे। मुझे खुशी है कि यह अभी काम कर रहा है .. अगर कोई और स्मार्ट पोस्ट के साथ बहुत कम 05AB1E उत्तर पोस्ट करता है तो मैं शायद इस जवाब को शर्म से हटा दूंगा ... xD
स्पष्टीकरण:
žGç # Character with unicode 32768 ('耀')
U # Pop and store it in variable `X`
# (This character is not part of the printable ASCII, nor of my 05AB1E code)
| # Take the multi-line input as list
# i.e. "Ybb\nYH%\n%%%%" → ["Ybb","YH%","%%%%"]
€S # Convert each string to a list of characters
# i.e. ["Ybb","YH%","%%%%"] → [["Y","b","b"],["Y","H","%"],["%","%","%","%"]]
Xζζ # Zip with character `X` as filler twice to make the lines of equal length
# i.e. [["Y","b","b"],["Y","H","%"],["%","%","%","%"]]
# → [["Y","b","b","耀"],["Y","H","%","耀"],["%","%","%","%"]]
D # Duplicate this list
" " # Create a string
© # Which we store in the register (without popping)
.V # And execute that string as 05AB1E code
ε # Map each inner list to:
γ # Split in chunks of the same characters
# i.e. [["Y","b","b"],["Y","H","%"],["%","%","%","%"]]
# → [[["Y"],["b","b"]],[["Y"],["H"],["%"]],[["%","%","%","%"]]]
ε # Map each of those to:
D # Duplicate the current inner list
gDi # If its length is exactly 1:
s # Swap so the mapping keeps the duplicated single character (as list)
ë # Else:
Xи # Take character `X` repeated the length amount of times
# i.e. ["%","%","%","%"] (length 4) → ["耀","耀","耀","耀"]
] # Close the if-else and both maps
˜ # Flatten the list to a single list of characters
# i.e. [[["Y"],["耀","耀"],["耀"]],[["Y"],["H"],["%"],["耀"]],[["耀","耀","耀","耀"]]]
# → ["Y","耀","耀","耀","Y","H","%","耀","耀","耀","耀","耀"]
s # Swap so the duplicate list is at the top of the stack
ø # Swap its rows and columns
# i.e. [["Y","b","b","耀"],["Y","H","%","耀"],["%","%","%","%"]]
# → [["Y","Y","%"],["b","H","%"],["b","%","%"],["耀","耀","%"]]
®.V # Execute the same piece of code again that we've stored in the register
€S # Convert each to a list of characters
# i.e. [[["耀","耀"],["%"]],[["b"],["H"],["%"]],[["b"],["耀","耀"]],[["耀","耀"],["%"]]]
# → [["耀","耀","%"],["b","H","%"],["b","耀","耀"],["耀","耀","%"]]
ø # Swap its rows and columns back again
# i.e. [["耀","b","b","耀"],["耀","H","耀","耀"],["%","%","耀","%"]]
˜ # Flatten this list as well
‚ # Pair both lists together
# i.e. [["Y","耀","耀","耀","Y","H","%","耀","耀","耀","耀","耀"],
# ["耀","b","b","耀","耀","H","耀","耀","%","%","耀","%"]]
ø # Swap its rows and columns to create pairs
# i.e. [["Y","耀"],["耀","b"],["耀","b"],["耀","耀"],["Y","耀"],["H","H"],["%","耀"],["耀","耀"],["耀","%"],["耀","%"],["耀","耀"],["耀","%"]]
ʒË} # Filter out any inner lists where both characters are not equal
# i.e. [["耀","耀"],["H","H"],["耀","耀"],["耀","耀"]]
ʒXå≠} # Filter out any inner lists that contain the character `X`
# i.e. [["H","H"]]
g # Take the length as result
# i.e. [["H","H"]] → 1
q # Stop the program, making all other characters no-ops
# (and output the length above implicitly)