-1字节使用快速`
避免链接,正如Outgolfer的Erik建议的那样。
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"