You need to build a pyramid from cubes. Cubes can be viewed from 2 angles:
_____ _____
/\ \ / /\
/ \____\ /____/ \
\ / / \ \ /
\/____/ \____\/
This is an example for 2-size cubes from the 2 possible angles.
The height of the cubes is $size
slashes (or back-slashes), and the width of the cube is 2 * $size
underscores. The top level width should contain an extra underscore character.
Input will be provided as a string containing a number (size of cubes), slash or backslash (to indicate direction/angle), and another number (height of the pyramid).
Examples:
Input:
1/1
Output:
___
/\__\
\/__/
Input:
1\1
Output:
___
/__/\
\__\/
Input:
2/1
Output:
_____
/\ \
/ \____\
\ / /
\/____/
Input:
1/2
Output:
___
___/\__\
/\__\/__/
\/__/\__\
\/__/
Input:
2\2
Output:
_____
/ /\
/____/ \_____
\ \ / /\
\____\/____/ \
/ /\ \ /
/____/ \____\/
\ \ /
\____\/
Input:
1/3
Output:
___
___/\__\
___/\__\/__/
/\__\/__/\__\
\/__/\__\/__/
\/__/\__\
\/__/
- Trailing/leading whitespaces are OK.
- Standard loopholes are disallowed.
- You can assume input will always be valid.
- You may assume the input won't cause too big output, i.e: no line wrapping when the output is printed to the terminal.
- Size of cube & height of pyramid is positive (i.e. ≥ 1)
- This is code-golf, so shortest code in bytes wins.
Current Winner is:
Glen O with 270 bytes in julia
challenge stays open. if you beat the current best, I'll update the accepted answer.