A.rs;ò©n∍9ÝΩ®DnαLʒ®%Ā}<Ωǝ®ô»¹Éi.º.∊ëº∊
+11バイトはまだ奇数の入力に念頭に置いて規則3を維持しつつ、ランダム位置にある数字を修正する..
-2のおかげバイト@MagicOctopusUrn変化、îï
にò
との位置を変化させます»
。
オンラインで試して、さらにいくつかのテストケースを確認してください。
古い(29 27バイト)答えは、常に角のどこに数字が位置するか:
A.rs;ò©n∍¦9ÝΩì®ô»¹Éi.º.∊ëº∊
オンラインそれを試してみてくださいまたはいくつかのより多くのテストケースを検証します。
説明:
A # Take the lowercase alphabet
.r # Randomly shuffle it
# i.e. "abcdefghijklmnopqrstuvwxyz" → "uovqxrcijfgyzlbpmhatnkwsed"
s # Swap so the (implicit) input is at the top of the stack
; # Halve the input
# i.e. 7 → 3.5
ò # Bankers rounding to the nearest integer
# i.e. 3.5 → 4
© # And save this number in the register
n # Take its square
# i.e. 4 → 16
∍ # Shorten the shuffled alphabet to that length
# i.e. "uovqxrcijfgyzlbpmhatnkwsed" and 16 → "uovqxrcijfgyzlbp"
9ÝΩ # Take a random digit in the range [0,9]
# i.e. 3
®Dnα # Take the difference between the saved number and its square:
# i.e. 4 and 16 → 12
L # Create a list in the range [1,n]
# i.e. 12 → [1,2,3,4,5,6,7,8,9,10,11,12]
ʒ } # Filter this list by:
®%Ā # Remove any number that's divisible by the number we've saved
# i.e. [1,2,3,4,5,6,7,8,9,10,11,12] and 4 → [1,2,3,5,6,7,9,10,11]
< # Decrease each by 1 (to make it 0-indexed)
# i.e. [1,2,3,5,6,7,9,10,11] → [0,1,2,3,5,6,7,9,10]
Ω # Take a random item from this list
# i.e. [0,1,2,3,5,6,7,9,10] → 6
ǝ # Replace the character at this (0-indexed) position with the digit
# i.e. "uovqxrcijfgyzlbp" and 3 and 6 → "uovqxr3ijfgyzlbp"
®ô # Split the string into parts of length equal to the number we've saved
# i.e. "uovqxr3ijfgyzlbp" and 4 → ["uovq","xr3i","jfgy","zlbp"]
» # Join them by new-lines (this is done implicitly in the legacy version)
# i.e. ["uovq","xr3i","jfgy","zlbp"] → "uovq\nxr3i\njfgy\nzlbp"
¹Éi # If the input is odd:
# i.e. 7 → 1 (truthy)
.º # Intersect mirror the individual items
# i.e. "uovq\nxr3i\njfgy\nzlbp"
# → "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz"
.∊ # And intersect vertically mirror the whole thing
# i.e. "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz"
# → "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz\njfgygfj\nxr3i3rx\nuovqvou"
ë # Else (input was even):
º∊ # Do the same, but with non-intersecting mirrors