`
Erik the Outgolferが示唆したように、リンクを回避するためにクイックを使用して-1バイト。
H»þ`€Ḣ>ЀHSUṚm€0m0Y
... [a,b,c]
を使用してボックスを印刷するリストを取得する完全なプログラムa:2 b:1 c:0
は、実際には、最大10個のボックスで動作し、最も内側のボックスが0
(たとえば)です。
オンラインでお試しください!
どうやって?
H»þ`€Ḣ>ЀHSUṚm€0m0Y - Main link: list of boxes, B = [a, b, c]
H - halve B = [a/2, b/2, c/2]
€ - for €ach:
` - repeat left argument as the right argument of the dyadic operation:
þ - outer product with the dyadic operation:
» - maximum
- ... Note: implicit range building causes this to yield
- [[max(1,1),max(1,2),...,max(1,n)],
- [max(2,1),max(2,2),...,max(2,n)],
- ...
- [max(n,1),max(n,2),...,max(n,n)]]
- for n in [a/2,b/2,c/2]
Ḣ - head (we only really want n=a/2 - an enumeration of a quadrant)
H - halve B = [a/2, b/2, c/2]
Ѐ - map across right with dyadic operation:
> - is greater than?
- ...this yields three copies of the lower-right quadrant
- with 0 if the location is within each box and 1 if not
S - sum ...yielding one with 0 for the innermost box, 1 for the next, ...
U - upend (reverse each) ...making it the lower-left
Ṛ - reverse ...making it the upper-right
m€0 - reflect €ach row (mod-index, m, with right argument 0 reflects)
m0 - reflect the rows ...now we have the whole thing with integers
Y - join with newlines ...making a mixed list of integers and characters
- implicit print - the representation of a mixed list is "smashed"