29
2
The Triforce is a fictional artifact in The Legend of Zelda, made of three identical-looking equilateral triangles representing power, wisdom and courage. Several games in the saga include an animation when the three parts finally join together.
The purpose of this challenge is to draw a single 2D frame of such a simplified animation, with a given width for the triangles and a given spacing between the parts.
Input
The input consists of two integers: a width \$w\ge1\$ and a spacing value \$s\ge0\$.
Output
The frame has to be drawn according to the following specifications:
/\
/ \____________ this part is horizontally centered
/ \
/______\
\___ s empty lines
/
/\ /\
/ \ / \______ w+1 backslashes
/ \ / \
/______\ /______\
\_______ 2w underscores
|__|
\_____________ 2s spaces
In the above example, we have \$w=3\$ and \$s=2\$.
More examples
\$w=1\$, \$s=0\$:
/\
/__\
/\ /\
/__\/__\
\$w=2\$, \$s=0\$:
/\
/ \
/____\
/\ /\
/ \ / \
/____\/____\
\$w=3\$, \$s=3\$:
/\
/ \
/ \
/______\
/\ /\
/ \ / \
/ \ / \
/______\ /______\
\$w=4\$, \$s=1\$:
/\
/ \
/ \
/ \
/________\
/\ /\
/ \ / \
/ \ / \
/ \ / \
/________\ /________\
Rules
- Trailing spaces on each line are optional.
- Extra leading spaces on each line are not allowed.
- You may output a single extra leading newline and/or a single extra trailing newline.
- This is code-golf.
Uh, check your math on this. This may be 25 characters, but it's 50 to 65 bytes (depending on whether you use UTF-16 or UTF-8 representation, respectively). – Stuart P. Bentley – 2018-09-03T21:45:11.210
My bad; apparently, Charcoal and Canvas have their own character mappings, which seems a touch silly to me (if you're going to use arbitrary symbols, why not use an existing selection), but whatever.
– Stuart P. Bentley – 2018-09-03T21:58:02.163@StuartP.Bentley The point of this site is to golf program size. Many languages (there are many, many more than just Canvas & Charcoal) opted for utilizing all 8 bits per byte, since that's a very good way to reach closer to maximum golfiness. The pretty unicode is just for making code easier to read and write (you try programming in C by writing bytecode; we are humans too) – dzaima – 2018-09-03T22:14:25.820