Task
Your task is to write a program that will output ASCII boxes at the locations specified by the input.
Input
You will be given a list of numbers. The format here is a bit flexible, in that you can use any deliminator you want (e.g. 1,2,3,4
, 1 2 3 4
, [1,2,3,4]
). The list is in groups of 4 and specifies the xywh
of each box. The width and height of each box will be at least 2. x
and width
are left-to-right. y
and height
are top-to-bottom.
Output
Rendering can be thought of as right to left, with the box on the right drawn first, and every box after that is over it. Trailing spaces are allowed, as well as one trailing newline.
How to handle overlapping boxes
The box on the left of the input is the top box, and nothing will overlap it. Every box after it is rendered only in the space that is not contained in a box already and will not replace the border of a already rendered box.
Style
The style of the boxes are fairly standard, with +
used for corners, -
used for horizontal lines, and |
used for vertical lines.
Examples:
(>>>
denotes input)
>>>0 0 11 4 7 2 8 4 3 5 8 3
+---------+
| |
| |---+
+---------+ |
| |
+---+------+
| |
+------+
>>>0 3 11 4 7 5 8 4 3 8 8 3 4 0 13 5
+-----------+
| |
| |
+---------+ |
| |-----+
| |---+
+---------+ |
| |
+---+------+
| |
+------+
>>>0 0 2 2
++
++
>>>2 2 5 3 1 1 7 5 0 0 9 7
+-------+
|+-----+|
||+---+||
||| |||
||+---+||
|+-----+|
+-------+
>>>0 0 3 3 2 0 3 3
+-+-+
| | |
+-+-+
4 0 13 5
rather than0 4 13 5
? \$\endgroup\$