Draw ASCII boxes in boxes
Jelly, 20 19 bytes
-1 byte using the quick `
to avoid a link, as suggested by Erik the Outgolfer.
H»þ`€Ḣ>ЀHSUṚm€0m0Y
A full program taking a list [a,b,c]
printing the boxes using a:2 b:1 c:0
... in fact, as is, it will work for up to 10 boxes, where the innermost box is 0
(for example).
Try it online!
How?
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"
Python 2, 107 103 bytes
a,b,c=input()
r=range(1-a,a,2)
for y in r:
s=''
for x in r:m=max(x,y,-x,-y);s+=`(m>c)+(m>b)`
print s
Full program, prints boxes with a=2
,b=1
,c=0
Slightly worse answer, with list comprehension (104 bytes):
a,b,c=input()
r=range(1-a,a,2)
for y in r:print''.join(`(m>c)+(m>b)`for x in r for m in[max(x,y,-x,-y)])
Charcoal, 14 bytes
F#*@UO÷N²ι‖C←↑
Try it online! Link is to verbose version of code.