Å4bS{I·ƒDÂ~„ *èJ,À
オンラインでお試しください!
説明
の例 n=2
Å4 # push a list of 4s with length as the input
# STACK: [4,4]
b # convert each to binary
# STACK: [100, 100]
S{ # split into digit list and sort
# STACK: [0, 0, 0, 0, 1, 1]
I·ƒ # input*2+1 times do
D # duplicate top of stack
# 1st iteration: [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1]
# 2nd iteration: [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0]
# 3rd iteration: [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0]
Â~ # or each item in the duplicate with its reverse
# 1st iteration: [0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1]
# 2nd iteration: [0, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0]
# 3rd iteration: [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0]
„ *èJ # use the resulting binary list to index into the string " *"
# 1st iteration: [0, 0, 0, 0, 1, 1], "** **"
# 2nd iteration: [0, 0, 0, 1, 1, 0], " **** "
# 3rd iteration: [0, 0, 1, 1, 0, 0], " ** "
, # print
À # rotate list left
1
の代わり*
と0
スペースの代わりに?