34
4
The first Predecessor-completed Ascii Cube (PAC 1) is a simple cube with side length 1 and looks like this:
/////\
///// \
\\\\\ /
\\\\\/
The PAC 2 is a geometric shape such that combining it with its predecessor (the PAC 1) completes a side length 2 cube:
front back
/////////\ /////////\
///////// \ ///////// \
/////\\\\\ \ ///////// \
///// \\\\\ \ ///////// \
\\\\\ ///// / \\\\\\\\\ /
\\\\\///// / \\\\\\\\\ /
\\\\\\\\\ / \\\\\\\\\ /
\\\\\\\\\/ \\\\\\\\\/
Because the back-view is kind of boring, we are only interested in the front-view.
The same goes for the PAC 3: With some visual thinking the PAC 2 can be turned around and plugged into the PAC 3 to form a solid side length 3 cube:
/////////////\
///////////// \
/////\\\\\\\\\ \
///// \\\\\\\\\ \
///// /////\\\\\ \
///// ///// \\\\\ \
\\\\\ \\\\\ ///// /
\\\\\ \\\\\///// /
\\\\\ ///////// /
\\\\\///////// /
\\\\\\\\\\\\\ /
\\\\\\\\\\\\\/
And so on with PAC 4:
/////////////////\
///////////////// \
/////\\\\\\\\\\\\\ \
///// \\\\\\\\\\\\\ \
///// /////////\\\\\ \
///// ///////// \\\\\ \
///// /////\\\\\ \\\\\ \
///// ///// \\\\\ \\\\\ \
\\\\\ \\\\\ ///// ///// /
\\\\\ \\\\\///// ///// /
\\\\\ \\\\\\\\\ ///// /
\\\\\ \\\\\\\\\///// /
\\\\\ ///////////// /
\\\\\///////////// /
\\\\\\\\\\\\\\\\\ /
\\\\\\\\\\\\\\\\\/
Task:
Write a full program or function which takes a positive integer n as input and returns or prints the corresponding front-view of PAC n exactly as shown above. Additional trailing white space is acceptable.
This is code-golf, so try to use as few bytes as possible in the language of your choice.
Is it okay to print laterally inverted output, i.e. switch left and right? – busukxuan – 2017-02-18T17:32:57.947
No, it's part of the challenge to keep the "lighting" consistent. – Laikoni – 2017-02-18T17:39:32.213
Usually the bounty for code-golf questions goes to the shortest answer to encourage competition and the golfing of answers, but it really can't be enforced, and you're more than welcome to award it to any answer that deserves it. – mbomb007 – 2018-03-29T19:57:30.587