Given two inputs -- one of them a non-empty printable ASCII string (including space, excluding newline), the other being one of two distinct, consistent values of your choice (1 / 0
, l / r
, left / right
, etc.) -- output an ASCII art airplane banner of the string, pointing either left or right. For consistency, I'll be using left
and right
throughout this challenge description.
The plane is either |-DI>-/
(left
) or \-<ID-|
(right
). Since the banner is clear, it consists of the input string's characters separated by spaces, either left-to-right (left
) or right-to-left (right
), and surrounded by a box of the shape
/--/
---< <
\--\
or
\--\
> >---
/--/
Note there must be one space between the beginning/end of the message and the >
,<
characters.
For example, here is the message HAPPY BIRTHDAY!
and the direction left
:
/-------------------------------/
|-DI>-/---< H A P P Y B I R T H D A Y ! <
\-------------------------------\
Here is the message PPCG
and the direction right
. Note that the letters appear "backwards" when viewed from this side of the banner:
\---------\
> G C P P >---\-<ID-|
/---------/
Rules
- Leading or trailing newlines or whitespace are all optional, so long as the characters themselves line up correctly.
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- If possible, please include a link to an online testing environment so other people can try out your code!
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
eval
- Input a program that generates a left-facing plane for left, and a program that generates a right-facing plane for right. \$\endgroup\$