ASCII Rubik's Cube

Inspired by this and the following chat:

   _ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/


Extra leading or trailing whitespace is allowed, as long as it does not change the appearance of the cube. As usual, returning the above or a list of strings from a function is allowed.

This is , so shortest answer in bytes wins!

• Sandbox – Stephen Jun 26 '17 at 12:52
• Related. (As well as, more tangentially, a couple of other challenges you can find when searching for "diamond tiling".) – Martin Ender Jun 26 '17 at 12:56
• 10 hours in the Sandbox (especially with only one upvote) is hardly enough. I'd recommend waiting at least 48 hours. – Dada Jun 26 '17 at 12:56
• To explain my downvote: I don't really like the challenge, because the image is taking much of the space, and I feel like you are more trying to show a funny image than to make a good challenge (even more since the pattern isn't the same as the one on the picture) (and I'm quite sure this will attract some upvotes from people that just laughed at the picture). Also, "output this exact string" with a string that looks more or less than this one has been done several times, and I fail to see how your challenge is different enough to be interesting. – Dada Jun 26 '17 at 13:20
• @StephenS I gave +1, but I disagree that you can say the same for any KC challenge, when I make a KC challenge I make sure to make the pattern somewhat complex (so charcoal doesn't just auto-win), I make longer patterns so languages that can handle loops better have a chance (Like JS) and I try to use things that some languages might have built in like the alphabet, KC challenges differ a lot, and trying to say they are all the same takes something away from the category. – LiefdeWen Jun 26 '17 at 13:32

SOGL V0.12, 27 bytes

Y=Q∫+ZΔ○H!╝Ηūf⅟Ξ∆׀Æģ≠a⁶‘6«n


Try it Here!

Sadly, the palendromization version qE½Dε▒2β[}█O%q‘6«n╬∑ doesn't really work

Charcoal, 28 23 bytes

Ｆ³⁺⁺×\_³×\/⁻³ι¶ ‖Ｍ↑×_ ³


Try it online! Link is to verbose version of code. Not very Charcoal-y I know. I didn't realise that ‖Ｍ↓ deliberately moves the cursor so I had originally tried Ｆ³«Ｐ⁺×/_³×/\⁻³ι↗»‖Ｍ↓×_ ³ which didn't work, because I was trying to do it upside-down. If you want something more Charcoal-y then try Ｇ↗³←⁶↘³/\¶\/Ｇ↖³←⁷↘³_\¶\_↘‖Ｍ↑×_ ³ for 32 bytes: Try it online!

Bubblegum, 35 bytes

00000000: 5350 5088 0741 2e05 05fd 7830 8ce1 82b3  SPP..A....x0....
00000010: 806c 0413 c889 8907 4330 8f4b 01c1 036a  .l......C0.K...j
00000020: 8671 00                                  .q.


Try it online!

• outgolfed in bubblegum 😲 – Uriel Jun 26 '17 at 14:06

><>, 97 94 93 89 bytes

">knknknk//>k>knknknk/>k>k>knknknkk>k>k>n>n>n>k>k>n>n>n>/k>n>n>n>//n/n/n///"01.
of-


Try it online!

Edit 3: Figured out that you can use the character "" (ascii 25) - Now the process just takes 15 off every stack item and prints. Also removed extra directional instructions and replaced all with 1 move (01.)

Python 2, 81 bytes

i=7
while i:k=min(i,7-i);i-=1;print' '*(3-k)+'\/___ '[i/3::3]*3+k*'\//\\'[i>2::2]


Try it online!

Tail, 99 bytes

#!/bin/tail -n+2
_ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/

• Welcome to PPCG! – Stephen Jun 26 '17 at 15:21
• Or the #!/bin/sed 1d variant – sch Jun 26 '17 at 16:03

Python 3, 98 94 bytes

@KevinCruijssen suggested this...

-4 bytes thanks to @HyperNeutrino and @WheatWizard

Output Hardcoding solution:

print(r"""   _ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/""")


Try it online!

or, 98 bytes:

print("   _ _ _\n  /_/_/_/\\\n /_/_/_/\/\\\n/_/_/_/\/\/\\\n\_\_\_\/\/\/\n \_\_\_\/\/\n  \_\_\_\/")


Try it online!

Python 3, 139 bytes

Dumb Python 3 Non-Hardcoding sumbmission, sure it can be golfed. Surprisingly, compressing the two fors in just one loop is longer:

p=print;p(' '*3+"_ "*3)
for i in range(3):p(abs(2-i)*' '+'/_'*3+'/'+i*"\/"+'\\')
for i in range(3):p(i*' '+'\\_'*3+'\\'+"/\\"*abs(2-i)+'/')


Try it online!

Python 3, 140 bytes

print(' '*3+"_ "*3,'\n'+'\n'.join(abs(2-i)*' '+'/_'*3+'/'+i*"\/"+'\\'if i<3else (i-3)*' '+'\\_'*3+'\\'+"/\\"*abs(i-5)+'/'for i in range(6)))


Try it online!

Bubblegum, 42 bytes

0000: e0 00 4f 00   22 5d 00 10   68 13 e2 04   15 00 b7 11 │ à.O."]..h.â...·.
0010: 7a 0e c5 f5   30 27 b5 b3   3d 39 8f a6   1f f9 74 52 │ z.Åõ0'µ³=9.¦.ùtR
0020: c5 66 98 bd   bd 0a 9a 8d   44 00                     │ Åf.½½¶..D.


Java 8, 112 bytes

o->"   _ _ _\n  /_/_/_/\\\n /_/_/_/\\/\\\n/_/_/_/\\/\\/\\\n\\_\\_\\_\\/\\/\\/\n \\_\\_\\_\\/\\/\n  \\_\\_\\_\\/"


Hard-coded output.

Try it here.

• Can I edit the JS and C# hardcoded parts into your answer? – LiefdeWen Jun 26 '17 at 13:36
• Okay you can save 5 bytes on C# with verbatim literal so o=>@"... and then replace \n with an actual newline. – LiefdeWen Jun 26 '17 at 13:46

C#, 86 bytes

o=>@"   _ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/"


Try it here.

• Challenging. Found a slightly smaller total size (header+footer+code), but exchanges smaller header/footer for slightly larger main than yours: Try it online! – Mark Rejhon Jun 26 '17 at 22:39
• @MarkRejhon Unfortunately it's the main part that counts with the default program or function. ;) With the added o=>{} it would be 98 bytes in your case. – Kevin Cruijssen Jun 27 '17 at 6:50

Retina, 59 bytes


_¶  /_/\¶ /_/V\¶/_/VV\¶\_VVV¶ \_VV¶  \_V
._
$&$&$& V \/  Try it online! Explanation: The first stage simply creates the following:  _ /_/\ /_/V\ /_/VV\ \_VVV \_VV \_V  The second stage then expands all the _s by repeating them and the previous character 3 times, while the third stage turns the Vs into \/s. PHP, 77 bytes <?=strtr(' _ _ _ 0\ 01\ 011\ 2111 211 21',["/_/_/_/","\/","\_\_\_"]);  Try it online! • Save 4 bytes: Try it online! – Neil Jun 26 '17 at 17:00 • @Neil Thank You and additional 2 Bytes saved – Jörg Hülsermann Jun 26 '17 at 17:02 • It's always great when you can outperform literal output! – Neil Jun 26 '17 at 17:04 05AB1E, 34 31 bytes „_ 3×Âð'/:3F„/\«∞2äRˆD}\)¯R«.c  Try it online! Explanation „_ 3× # push the string "_ _ _ " Â # push a reversed copy ð'/: # replace spaces with slashes 3F # 3 times do „/\« # append "/\" ∞ # mirror 2ä # split into 2 separate parts on stack Rˆ # reverse the second part and push to global list D # duplicate the remaining part } # end loop \) # discard the last copy and wrap stack in a string ¯R # push the global list and reverse it « # append to the rest of the list .c # pad lines to equal length  Alternate 31 byte solution „ _3×3FDð'/:„/\«∞2äR.Á})ÀÀÀ.c¦  • ÀÀÀ in that alternate version [O_O"]... – Magic Octopus Urn Jun 27 '17 at 18:48 • @MagicOctopusUrn: Yeah... I haven't found a shorter way to do or get around it :P – Emigna Jun 27 '17 at 18:54 • I concur, I spent a couple minutes trying too; there's no way around it I can see xD. – Magic Octopus Urn Jun 27 '17 at 18:56 CSS, 225 223 bytes -2 bytes thanks to Stephen S, extra spaces removed I'm not exactly sure if this counts because CSS isn't really a programming language, but technically CSS can be standalone since the <html> element is autogenerated if there isn't one. html:after{content:' _ _ _ \A /_/_/_/\005c\A /_/_/_/\005c/\005c \A /_/_/_/\005c/\005c/\005c \A \005c_\005c_\005c_\005c/\005c/\005c/ \A \005c_\005c_\005c_\005c/\005c\/\A \005c_\005c_\005c_\005c /';white-space: pre;} And here's a version with a monospaced font, 247 246 bytes. -1 byte thanks to Stephen S, extra spaces removed html:after{font-family:'Courier';content:' _ _ _ \A /_/_/_/\005c\A /_/_/_/\005c/\005c \A /_/_/_/\005c/\005c/\005c \A \005c_\005c_\005c_\005c/\005c/\005c/ \A \005c_\005c_\005c_\005c/\005c\/\A \005c_\005c_\005c_\005c /';white-space: pre;} • I think you can delete some spaces in the CSS around :s and {}s – Stephen Jun 26 '17 at 20:25 05AB1E, 3532 31 bytes "/ _\"•₁7æ¤ÝI}?ÕR&Ü•4вè4ôJ€∞ø¨»  Try it online! 100% different method than Emigna. Edit: If I start with the pattern already transposed I can cut out 3 bytes. "/ _\" # Push ASCII-art characters used. •₁7æ¤ÝI}?ÕR&Ü•4в # Push transposed version of base-4 pattern. è # Replace all digits in base-4 number with appropriate symbol. 4ô # Split into groups of 4. J # Join together. €∞ # Mirror each row (technically column). ø # Transpose back. ¨» # Remove the extra "_ _ _", and print with newlines.  JavaScript (ES6), 95 bytes _=>String.raw _ _ _ /_/_/_/\ /_/_/_/\/\ /_/_/_/\/\/\ \_\_\_\/\/\/ \_\_\_\/\/ \_\_\_\/  JavaScript (ES6), 103 94 bytes -9 bytes thanks to @Shaggy _=> _ _ _${a=/_/_/_/\\}
${a}/\\${a}/\\/\\
${b=\\_\\_\\_\\/}\\/\\/${b}\\/
${b}  JavaScript (ES6), 106 bytes _=> _ _ _ /_/_/_/\\ /_/_/_/\\/\\ /_/_/_/\\/\\/\\ \\_\\_\\_\\/\\/\\/ \\_\\_\\_\\/\\/ \\_\\_\\_\\/  • – Shaggy Jun 26 '17 at 17:06 • @Shaggy duh, I knew that, even used it recently. Thanks! – Stephen Jun 26 '17 at 17:11 • 93 bytes – Joshua Bell Jun 26 '17 at 19:30 • @JoshuaBell feel free to post that as your own answer, that's definitely not a golf of mine :) (it's also very ingenius) – Stephen Jun 26 '17 at 19:32 Ruby, 72 70 bytes 7.times{|i|puts' '*(j=i^i/4+3)+'_ \_/_'[-i/3*2,2]*3+'/\/'[i/4,2]*j^=3}  Latest edit: avoid double \ by enclosing strings in '' instead of "". Ungolfed (note in Ruby negative string indexes wrap around. -1 is the last character.) 7.times{|i| #7 lines. puts" "*(j=i^i/4+3)+ #Print j= 3,2,1,0, 0,1,2 spaces. "_ \\_/_"[-i/3*2,2]*3+ #Print 3 repeats of 2 characters from the string, index 0,-2,-2,-2,-4,-4,-4. "/\\/"[i/4,2]*j^=3 #Print 2 characters from the string, /\ or \/, repeated 3^j times. }  Windows Batch, 122 bytes @echo _ _ _ @echo /_/_/_/\ @echo /_/_/_/\/\ @echo /_/_/_/\/\/\ @echo \_\_\_\/\/\/ @echo \_\_\_\/\/ @echo \_\_\_\/  Pretty self-explantory. Brainf*ck 387 bytes Not even sure if this is still a thing but I was bored and did it for sh*ts and giggles :) ++++++++[->++++>++++>++++>++++<<<<]+++++[->>+++>+++>+++<<<<]<+++[->+++++<]>[->>>+++>+++<<<<]>>>>+++<<<...<+++[->.>>>.<<<<]<<++++++++++>+++++++++++++.<.>>>..>.<<+++[->>>>.<<.<<]>>>.<<<<.<.>>>.>.<<+++[->>>>.<<.<<]>>>.<.>.<<<<.<.>>>>.<<+++[->>>>.<<.<<]>>>.<.>.<.>.<<<<.<.>>>>>.<<<+++[->>>>.<.<<<]>>.>.<.>.<.<<<.<.>>>.>>.<<<+++[->>>>.<.<<<]>>.>.<.<<<.<.>>>..>>.<<<+++[->>>>.<.<<<]>>.<<<.<.>>  Edit: TIL: I am 54.28% more effective than some generator I found online ^.^ Edit2: Try it online Make sure Wrap is on for Memory overflow behaviour in the options COBOL, 238 bytes Compiled with open-cobol. Note that the indentation is a single tab, not spaces, even if this website formats it that way.  IDENTIFICATION DIVISION. PROGRAM-ID. a. PROCEDURE DIVISION. DISPLAY " _ _ _". DISPLAY " /_/_/_/\". DISPLAY " /_/_/_/\/\". DISPLAY "/_/_/_/\/\/\". DISPLAY "\_\_\_\/\/\/". DISPLAY " \_\_\_\/\/". DISPLAY " \_\_\_\/". STOP RUN.  Perl 5, 89 bytes say" _ _ _";$r[7-$_]=($r[$_]=$"x(3-$_).'/_'x3 .'/\\'x$_.\$/)=~y|/\\|\\/|r for 1..3;say@r


Try it online!

Python 2, 93 bytes

print r"""   _ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/"""
`

Try it online!