#Befunge, 277 269 bytes
Befunge, 277 269 bytes
&6*4+00p&:55+*3+10p2%20pv@
6+5:g03%*54:::<<0+55p03:<<v%*54++55:\p04:**`+3g03g00`\g01+*3!g02\-*84g+3+!\%
48*+,1+:10g`!#^_$,1+:00g-|>30g:2+6%\3-!+3+g48*-\:2`\20g3*+10g\`*30g2`**40g!*+
/\ \
/ \ \
/ \ _____\
\ / /
\ / /
\/_____ /
_____
This question looked deceptively easy, but the edge cases turned out to be more complicated than I had originally anticipated. The best approach I could come up with was to handle the odd and even columns as separate renderings, and then just merge the results.
So for each x,y coordinate that has to be output, we first need to determine what character should be rendered for an odd column, by mapping the x,y output coordinates to u,v coordinates in the cube diagram as follows:
u = x%20
v = (y+5)%6 + (y==0)
The addition of (y==0)
is to handle the special case of the first line. But we also need to make sure we aren't rendering the last few lines at the bottom of the column, and the last few characters on the end of each row. This is achieved by multiplying output character with the expression:
(y > h-3) && (x > w-3*!(columns%2))
The !(columns%2)
in the width calculation is because the amount we need to trim off the end is dependent on whether the total column count is even or odd.
We then do a second calculation to determine what character should be rendered for an even column, mapping the u,v coordinates as follows:
u = (x+10)%20
v = (y+2)%6 + (y==3)
This is the same basic calculation as used for the odd columns, but offset slightly. And as before, we need to make sure we don't render some of the characters on the boundaries - this time the first few lines at the top of the column, as well as some characters at the beginning and end of each row. The expression we multiply in this case is:
(y > 2) && (x > 2) && (x < w-3*(columns%2))
Having calculated these two potential output characters, the final value used is:
char1 + (char2 * !char1) + 32
In other words, if char1 is zero we need to output char2, otherwise we output char1. If both are non-zero, we're just going to output char1, but that's fine because they'd both be the same value anyway. Also note that these character values are offset by 32 (hence the addition of 32) so that zero will always end up as a space.