# Embedded Diamonds!

No, not this. And not this either. This question is nothing like those

Write the shortest code to print/return the following output:

   /\      /\      /\
/  \    /  \    /  \
/ /\ \  / /\ \  / /\ \
/ /  \ \/ /  \ \/ /  \ \
\ \  / /\ \  / /\ \  / /
\ \/ /  \ \/ /  \ \/ /
\  / /\ \  / /\ \  /
\/ /  \ \/ /  \ \/
/\ \  / /\ \  / /\
/  \ \/ /  \ \/ /  \
/ /\ \  / /\ \  / /\ \
/ /  \ \/ /  \ \/ /  \ \
\ \  / /\ \  / /\ \  / /
\ \/ /  \ \/ /  \ \/ /
\  /    \  /    \  /
\/      \/      \/

• Standard methods of input/output.
• Standard loopholes apply.
• Trailing/leading whitespace is okay, in any amount.

# Charcoal, 2824 23 bytes

↗²↖↙⁴⟲Ｐ²⁴⁶↘↙↙²⟲Ｐ²⁴⁶Ｃ⁸¦⁰


Try it online! Explanation:

↗²↖↙⁴   Draw the top left 4x4 corner
/
//
⟲Ｐ²⁴⁶   Rotate it three times to complete a diamond
/\
//\\
\\//
\/
↘↙↙²    Draw the top left line of the inner diamond
/\
//\\
\\//
\//
⟲Ｐ²⁴⁶   Rotate three times to complete five diamonds
Ｃ⁸¦⁰    Copy everything 8 characters to the right to complete eight diamonds


Edit: My previous answer used ‖Ｍ‖Ｍ↓ to create a whole diamond by reflecting the top corner, but due to a bug in Charcoal this left the cursor out of position. Fortunately I discovered another way of achieving the same effect which doesn't move the cursor, which meant that I saved a byte drawing the inner diamond. (I also looked into overlapping operations, but I wasn't able to improve on the rotate/copy approach.)

Edit: ↖²↗↘⁴‖Ｍ¬Ｍ¹¦³↘²‖Ｍ¬Ｃ⁸¦⁰ does the job in 21 bytes, but that relies on the new reflecting behaviour, so I don't know whether this was possible with the old code.

• Yeah, sorry, it was a bug - I've fixed it and will try to push ASAP, but this is still insanely short :O +1 – ASCII-only May 7 '17 at 1:52
• @ASCII-only If I've been using TIO, how does that affect me? – Neil May 7 '17 at 9:33
• Well, it's still cached, so as long as it is cached, it should be fine if that's what you mean – ASCII-only May 7 '17 at 10:14
• @ASCII-only What I want to know is that when TIO's behaviour changes I would like to be able to provide an updated (although non-competing) link. – Neil May 7 '17 at 10:16
• Oh, in that case it already has the fix – ASCII-only May 7 '17 at 10:17

# Charcoal, 6250484542 40 bytes

Thanks to @Okx for saving two bytes!

↙²→↘²↙↖⁴→↗⁴‖ＭＦ²Ｃ⁸¦⁰Ｍ⁸↓→↗²↓↘²Ｍ⁴→↑↗²↓↘²‖Ｍ↓


Try it online!

Explanation:

↙²→↘²          // Draw the left half of the inner part of the first diamond.
↖⁴→↗⁴          // Draw the left half of the outer part.
‖Ｍ             // Mirror the half of the diamond to create the first full diamond.
Ｆ²Ｃ⁸¦⁰         // Copy the picture eight characters to the left twice.
// The first copy gives us two diamonds, and the second copy of the
// two diamonds overlaps so that the result is three diamonds.
Ｍ⁸↓→↗²↓↘²     // Move down to draw the upper inner half of the first middle diamond.
Ｍ⁴→↑↗²↓↘²     // Move right to do the same for the second middle diamond.
‖Ｍ↓           // Mirror the whole thing vertically.

• You can replace Ｃ⁸¦⁰Ｃ⁸¦⁰ with Ｆ²Ｃ⁸¦⁰¦ to save a byte. – Okx May 5 '17 at 9:45
• @Okx Thanks! Actually, this saves two bytes, because it works without the trailing ¦. – Steadybox May 5 '17 at 11:33
• For the record, some update seems to have broken this, as the code no longer works properly on TIO. The answer still remains valid, because it worked with the version TIO was using back when this answer was posted. – Steadybox Nov 27 '17 at 22:09

# 05AB1E, 4544 43 bytes

Code:

…/ \©•—‹íćCé']d₂2ó@¯çX‘¯¨•3вè8äJvyÂ®Â‡«}»Â»


Pre-explanation:

The •—‹íćCé'\]d₂2ó@¯çX‘¯¨•3в part is just a compressed version of the following array:

[1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 2, 1, 2, 0, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 2, 1, 2, 0, 1, 0, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 1, 1, 2, 0, 1, 0, 1, 1, 2, 1, 2]


Which we index into the string …/ \. This maps 0 -> /, 1 -> space, 2 -> \. After that, we process this string with the following program:

8äJvyÂ®Â‡«}»Â»

8ä               # Split the array into 8 pieces
J              # Join each sub-array in the array
vy     }      # For each string in the array
Â           #   Bifurcate (duplicate and reverse)
®          #   Push the string "/ \" (which was copied using ©)
Â         #   Bifurcate to get "\ /"
‡        #   Transliterate / -> \ and \ -> /
«       #   Append to the original string
»     # Join the entire stack on newlines
Â    # Bifurcate
»   # Join the stack by newlines


Uses the 05AB1E encoding. Try it online!

• 05AB1E is very good at ASCII-art, it seems... – Esolanging Fruit May 5 '17 at 2:10
• Crossed out fourty four is still fourty four. – Okx May 5 '17 at 9:44
• @Okx Unless you apply non-breaking spaces. – Steadybox May 5 '17 at 11:37

# PHP, 126 Bytes

<?=gzinflate(base64_decode("vY7BCQAwCAP/mSIbuJD7z1GJLbbiuz5yKCeEpDk1RUSQWm8iMiRnIyw178Qgi5hs3ceHOA86snN7ON2b/687X+7umuIC"));


Try it online!

# PHP, 149 Bytes

$s=strtr("000 111 222 333 444 555 \ 22 / \\33/ ",[" /\ "," / \ "," / /\ \ ","/ / \ \\","\ \ / /"," \ \/ / "]);echo"$s
".strrev($s);  Try it online! # JavaScript, 232 bytes _=>(a=3868683 2/274/274/272 1/18172/18172/18171 /1/27191/27191/2717 7172/18172/18172/1/ 17191/27191/27191/1 272/18172/18172/2 391/27191/27193.replace(/\d/g,n=>n>6?['\\','/\\','\\/'][n-7]:' '.repeat(n)))+ +[...a].reverse().join  ### Try it online! const f = _=>(a=3868683 2/274/274/272 1/18172/18172/18171 /1/27191/27191/2717 7172/18172/18172/1/ 17191/27191/27191/1 272/18172/18172/2 391/27191/27193.replace(/\d/g,n=>n>6?['\\','/\\','\\/'][n-7]:' '.repeat(n)))+ +[...a].reverse().join console.log(${f()}
)

• I have a 126 byte solution below. :) – Steve Bennett May 18 '17 at 14:02

# Ruby, 99 97 bytes

400.times{|i|print (23<x=i%25)?$/:" / \\ "[(x^y=i/25)&4^x+y&1^(x-2&4&y-2>y/6%2*x/2%11*4?2:0)]}  Explanation Each 4x4 square contains only spaces and / or \. We plot these to give the overall diamond pattern. To avoid partial patterns at the borders, certain 2x2 squares must be left blank as below. .. /\ .... /\ .... /\ .. ../ \..../ \..../ \.. / /\ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \ \ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \/ / ..\ / /\ \ / /\ \ /.. .. \/ / \ \/ / \ \/ .. .. /\ \ / /\ \ / /\ .. ../ \ \/ / \ \/ / \.. / /\ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \ \ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \/ / ..\ /....\ /....\ /.. .. \/ .... \/ .... \/ ..  Ungolfed version - modified to print the above to assist in explanation 400.times{|i|print (23<x=i%25)?$/:     #Calculate x. If last column, print a newline else
" /..\\ .."[(x^y=i/25)&4^x+y&1^      #If (x^y)&4==4, use x+y&1 to select between space and /. If (x^y)&4==0 select between \ and space.
(x-2&4&y-2>y/6%2*x/2%11*4?2:0)]      #If x-2&4&y-2==4, and we are on the 2 character wide border (y/6%2*x/2%11==0), XOR with 2 to print .
}


# Pyth - 1069896 92 bytes

V16V24J%t+NH8K%+_2-NH8=Y&&&>H1>N1<N14<H22p?|q2J&&Y!%J4?<1%H4J!J\/?|q2K&&Y!%K4?<1%H4!KK\\d)pb


Try it

# C#, 608 bytes

void q(){Action<string>a=Console.Write;Func<int,int,string>b=(c,d)=>new string(' ',c)+(d<1?"/\\":d<2?"/  \\":d<3?"/ /\\ \\":d<4?"/ /  \\ \\":d<5?"\\ \\  / /":d<6?"\\ \\/ /":d<7?"\\  /":"\\/");Action e=()=>a(b(0,4)+b(0,4)+b(0,4)+"\n"+b(1,5)+b(2,5)+b(2,5)+"\n");Action f=()=>a(b(1,2)+b(2,2)+b(2,2)+"\n");Action g=()=>a(b(0,3)+b(0,3)+b(0,3)+"\n");a(b(3,0)+b(6,0)+b(6,0)+"\n"+b(2,1)+b(4,1)+b(4,1)+"\n");f();g();e();a("  \\  / /\\ \\  / /\\ \\  /\n"+"   \\/ /  \\ \\/ /  \\ \\/\n"+"   /\\ \\  / /\\ \\  / /\\\n"+"  /  \\ \\/ /  \\ \\/ /  \\\n");f();g();e();a(b(2,6)+b(4,6)+b(4,6)+"\n"+b(3,7)+b(6,7)+b(6,7)+"\n");}

• Not that I want to make this any longer but it looks like you're missing using System;. I'm also pretty sure you can golf this more but I haven't spent too much time looking to be 100% sure. – TheLethalCoder May 18 '17 at 8:11
• Its longer than the output so just System.Console.WriteLine(@"..."); Will beat my answer by like 200 bytes. – LiefdeWen May 18 '17 at 8:20

# C#, 382 291 bytes

_=>string.Format(@"{5}{5}{5}
{2}{2}{2}
{0}{0}{0}
{1}{1}{1}
\ \ {0}{0} / /
\ \{1}{1}/ /
\ {0}{0} /
\{1}{1}/
/\ \ {0} / /\
/  \ \{1}/ /  \
{0}{0}{0}
{1}{1}{1}
\ \ {0}{0} / /
\ \{1}{1}/ /
{4}{4}{4}
{3}{3}{3}",@" / /\ \ ",@"/ /  \ \",@"  /  \  ",@"   \/   ",@"  \  /  ",@"   /\   ");


## Javascript 126 bytes

for(c=r=a='';r<16;c++>22&&(r++,c=0,a+=
))C=c%22>1&&r%14>1,q=[1,,C&&r&2,,,,C&&~r&2,,1],a+=q[c+5+r&7]?'/':q[r-c+20&7]?'\\':' '


Since it's now pretty unreadable, a basic explanation:

• we tile the space top left to bottom right
• we draw it as basically 6 diagonal lines that repeat every 8 characters: 2 solid lines, and 4 that are "dashed" (two characters, then two spaces...)
• the C=... stuff is to limit drawing of some of the lines to within a bounding box
• to save a lot of characters, we deliberately add numbers to make the expressions for the upwards and downwards lines extremely similar
• then, put the expressions themselves into a sparse array [1,,C&&...], which we look up into. If there is a truthy value, we draw the appropriate character.

-

for(c=r=a='';r<16;c++>22&&(r++,c=0,a+=
))                 // basic grid tiling
C=c%22>1&&r%14>1,   // are we not near the edges
q=[1,               // a solid line that always draws
,                   // a line that never draws
C&&r&2,             // a line that draws if not near the edge, and if on the correct "dash" (r&2)
,,,
C&&~r&2,            // if not near the edge, and on the opposite "dash" (~r&2)
,1                  // the opposite diagonal line that always draws
],
a+=q[c+5+r&7]?'/' // compute which upward line we're on, check whether to draw it
:q[r-c+20&7]?'\\' // do the same for the downward line
:' '                // otherwise draw a space


Maybe this explanation didn't help. :)

Try online: https://codepen.io/stevebennett/pen/WjgMpY

Hopefully I got the output right:

   /\      /\      /\
/  \    /  \    /  \
/ /\ \  / /\ \  / /\ \
/ /  \ \/ /  \ \/ /  \ \
\ \  / /\ \  / /\ \  / /
\ \/ /  \ \/ /  \ \/ /
\  / /\ \  / /\ \  /
\/ /  \ \/ /  \ \/
/\ \  / /\ \  / /\
/  \ \/ /  \ \/ /  \
/ /\ \  / /\ \  / /\ \
/ /  \ \/ /  \ \/ /  \ \
\ \  / /\ \  / /\ \  / /
\ \/ /  \ \/ /  \ \/ /
\  /    \  /    \  /
\/      \/      \/


# History

## 130

for(c=r=a='';r<16;c++>22&&(r++,c=0,a+=
))C=c%22>1&&r%14>1,q=[1,,C&&r&2,,,,C&&~r&2,,1],a+=q[(c+5+r)%8]?'/':q[(r-c+20)%8]?'\\':' '


## 133

for(c=r=a='';r<16;c++>22&&(r++,c=0,a+=
))C=c%22>1,q=[1,,C&&r&2&&r<14,,,,C&&~r&2&&r>1,,1],a+=q[(c+5+r)%8]?'/':q[(r-c+20)%8]?'\\':' '


## 137

for(c=r=a='';r<16;c++==23&&(r++,c=0,a+=
))C=c<22&&c>1,q=[1,,C&&r&2&&r<14,,,,C&&~r&2&&r>1,,1],a+=q[(c+5+r)%8]?'/':q[(r-c+20)%8]?'\\':' '


## 155

for(c=r=a='';r<16;c++==23&&(r++,c=0,a+=
))Z=(C=c<22&&c>1)&&~r&2&&r>1,Y=C&&r&2&&r<14,B=(c-r+12)%8,A=(c+5+r)%8,q=[1,,Y,,,,Z,,1],a+=q[A]?'/':q[8-B]?'\\':' '


## History: 172

for(c=r=a='';r<16;c++==23&&(r++,c=0,a+='\n'))a+=(Z=(C=c<22&&c>1)&&~r&2&&r>3,Y=C&&r&2&&r<12,B=(c-r+16)%8,A=(c+r)%8,A==3||A==5&&Y||A==1&&Z?'/':B==4||B==2&&Y||B==6&&Z?'\\':' ')


# Canvas, 18 bytes

４／２／３３╋╬２／７７╋╬：９１╋


Try it here!

Explanation:

4/           push a diagonal of length 4
2/         push a diagonal of length 2
33╋      insert that at [3;3] in the 1st diagonal
/
/
/ /
/ /
2/77╋       insert a 2-long diagonal in the bottom-right corner
/\
/  \
/ /\ \
/ /  \ \
\ \  / /
\ \/ /
\  / /
\/ /
╬      quad-palindromize with 0 overlap, creating most of the output
/\      /\
/  \    /  \
/ /\ \  / /\ \
/ /  \ \/ /  \ \
\ \  / /\ \  / /
\ \/ /  \ \/ /
\  / /\ \  /
\/ /  \ \/
/\ \  / /\
/  \ \/ /  \
/ /\ \  / /\ \
/ /  \ \/ /  \ \
\ \  / /\ \  / /
\ \/ /  \ \/ /
\  /    \  /
\/      \/
:91╋  overlap self on [9;1]


# Retina, 214 bytes


F/\E/\E/\¶B/B\BB/B\FAD D¶F\/ C C¶FD D /\¶BC CAF\B/BB\B/¶F\/E\/E\/
F
B
E
BBB
D
/\ \B/
C
/B\ \/
B

A
/  \¶ / /\ \  / /\ \  / /\ \¶/ /  \ \/ /  \ \/ /  \ \¶\ \  / /\ \  / /\ \  / /¶ \ \/ /  \ \/ /  \ \/ /¶  \  /


Try it online!