# Military projection of a cube

### Challenge closed, the shortest answer has been acccepted.

A military projection is a projection where all lengths and the angles in the X-Z plane remain unattuned.

Your task is to print a cube in military projection using /, |, \, -, and any whitespaces you want, given any integer greater than zero as it's side length. You can leave sides out that are not visible to the human eye. Here are some examples:

  /-\
/   \
|\   /| Side length:
| \ / | 2
\ | /
\|/

/-\
/   \
/     \
/       \
/         \
|\         /|
| \       / | Side length:
|  \     /  |
|   \   /   | 5
|    \ /    |
\    |    /
\   |   /
\  |  /
\ | /
\|/

/-\  Side length:
|\ /|
\|/  1


(Printing the side lengths is not required.)

For the uppermost corner you must use the dash. As you can see, all sides are equal in length (when measured in characters). You may use any kind of spacing you wish, and omit any characters that don't change the appearance of the cube.

This is , so the shortest answer in bytes wins!

• Are we guaranteed that the input is a positive integer? – Mr. Xcoder Jul 14 '17 at 19:58
• Hello, and welcome to PPCG! I'm going to vote to close this question as unclear because there are some things you need to specify. For example, will the input always be a positive integer? What range of inputs are possible? What do smaller or larger inputs look like? Could you explain in more detail how to draw the cube, and also provide some more examples? If you clarify these, I'll remove my close vote. :) – James Jul 14 '17 at 20:14
• Hope I could satisfy your need for clarification. – racer290 Jul 15 '17 at 11:50
• You can leave sides out that are not visible to the human eye. so, should we or not? You should specify that. – hyper-neutrino Jul 15 '17 at 19:44

# Charcoal, 19 bytes

Ｎθ←¹↙θ↓θ→↘θ↑↑θ←↖θ‖Ｂ


Try it online!

# Python 2.7, 198185 172 bytes

i=n=input();x=1;s,l,r,p='/|\ '
print p*n+'/-\\'
exec'x+=2;i-=1;print p*i+s+p*x+r;'*~-n+'i-=2;'+'i+=1;print l+p*i+r+p*x+s+p*i+l;x-=2;'*n+'print(n-i)*p+r+p*i+l+p*i+s;i-=1;'*n


Try it online!

Immense scope for golfing. I'm missing something out here, most probably!

Edit 1: -13 bytes: That's a start

Edit 2: -13 bytes: courtesy Erik the Outgolfer

• Sadly, Python needs extra bytes for escaping the backslashes, but nice answer anyway! – racer290 Jul 15 '17 at 13:17
• Thanks @racer290. Trying something out to see if it can be golfed any further. – Koishore Roy Jul 15 '17 at 13:19
• '/|\\ '=>'/|\ ' – Zacharý Jul 15 '17 at 22:35
• Some other -13... – Erik the Outgolfer Jul 16 '17 at 11:47

# SOGL V0.12, 393834 33 bytes

∫:┘ž}³№↕≥++┌.I1ž.┐∙:.2+.Iž0.I╬5╬⁷


Try it Here!

Explanation:

∫   }                              for 1-indexed range in the input
:                                   duplicate current index
┘ž                                 at [index; index] in POP (by default the input, but in the 1st cycle it gets overwritten) insert a "\"
³                             triplicate that array of a big diagonal
№↕                           mirror/reverse one of those vertically
≥                          put that at the stacks bottom
++                        join the three items together, resulting in the 3 diagonal lines of the result
┌.I1ž                   insert a dash at coordinates [input+1; 1] insert the dash
.┐∙                get an array of vertical bars with the size of the input (aka a vertical bar)
:               duplicate that
.2+.Iž         at postition [input+2; input+1] insert the 2nd vertical bar in the 1st (resulting in the required vertical bars the correct distance apart)
0.I╬5    at position [0; input+1] insert the vertical bars without overwriting spaces; as the position numbers are 1-indexed this extends the array left
╬⁷  palindromize horizontally, mirroring the required characters and with 1 overlap

• Wow, creative solution! =) – racer290 Jul 15 '17 at 11:47