title: This is my pillow

text:
# Question
Title: This is my pillow
...will you help me immortalize it?

I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use to recreate this pillow whenever I want to reminisce a bit.

It must work with no input arguments.

The output should look exactly like this (trailing newlines and spaces are OK).

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```

This is code golf, so the shortest code in bytes win!

---

## Leaderboard

```
var QUESTION_ID=98701,OVERRIDE_USER=31516;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```

```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```

```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```

# Answer
# 05AB1E, ~~18~~ 15 bytes

Code:

```
„/\5×{4Å6×»6F=R

```

Explanation:

```
„/\               # Push the string "/\"
   5×             # Repeat 5 times: "/\/\/\/\/\"
     {            # Sort, resulting in: "/////\\\\\"
      4Å6         # Create a list of 6's with length 4: [6, 6, 6, 6]
         ×        # Vectorized string multiplication
          »       # Join by newlines
           6F     # Do the following six times..
             =    #   Print with a newline without popping
              R   #   Reverse the string

```

Uses the **CP-1252** encoding. Try it online!
> 26 votes

# Answer
# ///, 116 bytes

```
/a/\\\\\\\\\\\\\\\///b/\\\\\\\\\\\\\\\\//A/aaaaa//B/bbbbb//C/ABABABABABAB
//D/BABABABABABA
/CCCCDDDDCCCCDDDDCCCCDDDD

```

Try it online!

**Edit**: the `\\\\\\\\\\\\\\\/` and `\\\\\\\\\\\\\\\\` are actually a *single* / and \\, respectively.

**Edit**: -3 because I thought of removing `i`. I think this can't be further golfed.
> 33 votes

# Answer
## Python 2, 49 bytes

```
b,a='\/';exec("print(a*5+b*5)*6;"*4+"a,b=b,a;")*6

```

Thanks to Mitch Schwartz for this clean method that saves a byte. The idea is to print four lines of `('\\'*5+'/'*5)*6`, swap the roles of slash and backslash, and then do that whole process 6 times. The two characters are stored in `a` and `b`, and swapped as `a,b=b,a`. The double-loop is double by generating the following code string, then executing it with `exec`:

```
print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;print(a*5+b*5)*6;a,b=b,a;

```

---

**50 bytes:**

```
s='/'*5+'\\'*5;exec("print s*6;"*4+"s=s[::-1];")*6

```

Makes the line string, prints it four times and then reverses it, then does that 6 times. Does so by generating the following code, then executing it:

```
print s*6;print s*6;print s*6;print s*6;s=s[::-1];print s*6;print s*6;print s*6;print s*6;s=s[::-1];print s*6;print s*6;print s*6;print s*6;s=s[::-1];print s*6;print s*6;print s*6;print s*6;s=s[::-1];print s*6;print s*6;print s*6;print s*6;s=s[::-1];print s*6;print s*6;print s*6;print s*6;s=s[::-1]

```

Here are some of the iterations of my golfing:

```
for c in([1]*4+[-1]*4)*3:print('/'*5+'\\'*5)[::c]*6

for i in range(24):print('/\\'*5+'\/'*5)[i/4%2::2]*6

for c in range(24):print('\\'*5+'/'*5)[::(c&4)/2-1]*6

for i in range(24):print('/'*5+'\\'*5)[::1-i/4%2*2]*6

for c in([1]*4+[0]*4)*3:print('\/'*5+'/\\'*5)[c::2]*6

for c in([1]*4+[0]*4)*3:print('\/'[c]*5+'/\\'[c]*5)*6

for c in(['/\\']*4+['\/']*4)*3:print(c[0]*5+c[1]*5)*6

for c in([5]*4+[-5]*4)*3:print('/'*c+'\\'*5+'/'*-c)*6

print((('/'*5+'\\'*5)*6+'\n')*4+(('\\'*5+'/'*5)*6+'\n')*4)*3

for x in(['/'*5+'\\'*5]*4+['\\'*5+'/'*5]*4)*3:print x*6

a='/'*5;b='\\'*5
for x in([a+b]*4+[b+a]*4)*3:print x*6

s='/'*5+'\\'*5
for x in([s]*4+[s[::-1]]*4)*3:print x*6

s=('/'*5+'\\'*5)*9
exec("print s[:60];"*4+"s=s[5:];")*6

a='/'*5;b='\\'*5
for i in range(24):print[a+b,b+a][i/4%2]*6

```
> 16 votes

# Answer
# 05AB1E, 15 bytes

```
„/\5×{R6×6FR4F=

```

Try it online!

Explanation:

```
„/\             # Push "/\"
   5×           # Repeat string five times: "/\/\/\/\/\"
     {          # Sort: "/////\\\\\"
      R         # Reverse: "\\\\\/////
       6×       # Repeat string six times
         6F     # Repeat the following six times:
           R    #   Reverse
            4F  #   Repeat the following four times:
              = #     Print without popping

```

Uses the **CP-1252** encoding.
> 14 votes

# Answer
# Bubblegum, 30 bytes

```
00000000: d307 8118 1020 9dc5 3544 3523 f8a4 b386  ..... ..5D5#....
00000010: aae6 e113 cfa3 f13c 1acf a3f1 0c00       .......<......

```

Obligatory Bubblegum answer.
> 9 votes

# Answer
## JavaScript (ES6), ~~68~~ ~~60~~ 58 bytes

A recursive function. Several optimizations inspired from chocochaos answer.

```
f=(n=1440)=>n--?'/\\'[n/240&1^n/5&1]+(n%60?'':`
`)+f(n):''

```

### Demo

```
f=(n=1440)=>n--?'/\\'[n/240&1^n/5&1]+(n%60?'':`
`)+f(n):''

console.log(f());
```
> 8 votes

# Answer
# Haskell, ~~77~~ ~~70~~ 57 bytes

```
a%b=(<*[1..a]).([1..b]>>)
unlines$4%3$5%6<$>["/\\","\\/"]

```

Boring `concat`s and `replicate`s instead of playing with sines. Old was:

```
unlines[["\\/"!!(ceiling$sin(pi*x/5)*sin(pi*y/4))|x<-[0.5..59]]|y<-[0.5..23]]

```
> 7 votes

# Answer
# Brainfuck, 140 bytes

```
>>>++++++++[>++++++>++++++++++++<<-]++++++++++>->----<<<<<+++[>++++[>++++++[>>.....>.....<<<-]>.<<-]++++[>++++++[>>>.....<.....<<-]>.<<-]<-]

```

:-D
> 7 votes

# Answer
# Python 2, ~~86~~ ~~80~~ ~~76~~ ~~74~~ 73 bytes

```
for z in range(24):a=('/'*5+'\\'*5)*24;print((a+a[::-1])*3)[z*60:z*60+60]

```

Could probably golf a few more off it but it's a start.

**Edit**

Saved 6 by removing some unneeded brackets

Another 4 by using a single string and then reversing it

Thanks @Adnan. Had a late night last night and still not fully awake yet :p

-1 by moving the `*24` to the variable instead of using it twice
> 6 votes

# Answer
# Brainfuck, 149 bytes

```
++++++++++>++++++[>++++++++<-]>->+++++++++[>++++++++++<-]>++>+++[<<++++[<<++++++[>.....>>.....<<<-]<.>>>-]++++[<<++++++[>>>.....<<.....<-]<.>>>-]>>-]

```

The best interpreter EVAR!

This uses 6 cells (no wrapping, no modulo). Here they are:

```
0A 00 2F 00 5C 00

```

The `00` cells are used for the loop counters. Here, the counters are filled in with initial values:

```
0A 06 2F 04 5C 03

```

The leftmost counter is for the innermost loop (yes, I use nested loops of depth 3). Please note that the 4th cell (`04` counter) is used twice, once for `/////\\\\\...`, and once for `\\\\\/////...` every time.

`0A`, `2F` and `5C` are the characters `\n`, `/` and `\`, respectively.
> 6 votes

# Answer
## Pyke, 16 bytes

```
"/\"6*5m*n+4*sD3

```

After update today that allowed `"` in string literals, 17 bytes

```
"/\\"6*5m*n+4*sD3

```

Try it here!
> 6 votes

# Answer
# Python 2.7 66 -\> 56 -\> 55 bytes

```
a="/"*5+"\\"*5;b=a[::-1];c=6*a+"\n";d=6*b+"\n";e=4*c+4*d;print e*3

```

new to code golfing

```
a="/"*5+"\\"*5;print(4*(6*a+"\n")+4*(6*a[::-1]+"\n"))*3

```

Thanks Stewie Griffin

Forgot a silly whitespace ;)
> 6 votes

# Answer
# Brainfuck, 179 bytes

```
->++++++++[-<++++++>]++>+++++++++[-<++++++++++>]++++++++++>>>>+++[-<++++[-<++++++[-<+++++[-<<<.>>>]+++++[-<<.>>]>]<<.>>>]++++[-<++++++[-<+++++[-<<.>>]+++++[-<<<.>>>]>]<<.>>>]>]

```

I know this isn't the best score in the thread but I wanted to try out brainfuck and give this a try.

**Edit:** I must've made an error while copypasting. This version should work
> 6 votes

# Answer
# Canvas, ~~10~~ 9 bytes

```
/５４＊╬６×３＊

```

Try it here!

Explanation:

```
/          push "/"
 54*       extend horizontally 5 times and vertically 4 times
    ╬      quad-palindromize with 0 overlap
     6×    repeat horizontally 6 times
       3*  and again vertically, 3 times

```
> 6 votes

# Answer
# Dyalog APL, 24 bytes

```
(60⍴5/0 4)⊖60/⍪∊3⍴⊂4/'/\'

```
> 5 votes

# Answer
# Ruby, 46 bytes

Creates the following string (70 characters, one set more than needed) then alternates between sampling characters `0..59` and `5..64`from it.

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

```

**code and output**

```
24.times{|i|puts ((?/*5+?\\*5)*7)[i/4%2*5,60]}

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

```

**interesting mistake (a 7 instead of a 5)**

```
24.times{|i|puts ((?/*5+?\\*5)*7)[i/4%2*7,60]}

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

```
> 5 votes

# Answer
# C, ~~66~~ 61 bytes

5 bytes saved thanks to orlp.

Straightforward character by character printing. 61 characters per row, last is newline (ASCII 10) and the others alternate between `/`47 and `\` 92.

```
i;f(){for(i=1463;i;)putchar(i--%61?i%61/5+i/244&1?92:47:10);}

//call like this
main(){f();}

```
> 5 votes

# Answer
# MATL, ~~18~~ 16 bytes

```
'\/'6:&+thK5&Y")

```

Try it online!

### Explanation

```
'\/'   % Push this string
6:     % Push array [1 2 3 4 5 6]
&+     % 6×6 matrix with all pair-wise additions from that array
th     % Concatenate horizontally with itself. Gives a 6×12 matrix
K      % Push 4
5      % Push 5
&Y"    % Repeat each entry of the matrix 4 times vertically and 5 times horizontally
       % This gives a 24×60 matrix
)      % Index (modularly) into the string. This produces the desired 24×60 char array

```
> 5 votes

# Answer
# Pyth, 22 bytes

```
V6V4V12p*5?%+bN2\\\/)k

```

Try it here.

Explanation:

```
V6                     Loop 6 times, with N from 0 to 5:
  V4                   Loop 4 times, with H from 0 to 3:
    V12                Loop 12 times, with b from 0 to 11:
      p                Print without newline
        *              The repetition
          5            5 times of
          ?            if
            %          the remainder
              + b N    when the sum of b and N
              2        is divided by 2
          \\           then the "\" character
          \/           else the "/" character
    )                  End
                       (implicitly print with newline)
  k                    k (empty string)
                       (implicit end)
                       (implicit end)

```

Sorry if the explanation is a little hard to understand, but it was kinda complicated.
> 5 votes

# Answer
# ,  ~~22~~  21 bytes

**Edit** One byte won, thanks @DjMcMayhem:

```
5á\5á/05ä$4Ä5x$p4Ä3ä}

```

Changes are:

* `Y4P` -\>  Use V duplicate line instead of Vim built-in command (this will add a blank line at the end of the paragraph)
* `3äG` -\> `3ä}` Duplicate the paragraph instead of the whole buffer (to avoid blank line generated by previous change)

---

**Original post**

```
5á\5á/05ä$Y4P5x$p4Ä3äG

```

Try it online

Decomposed like this:

```
5á\                    Write 5 \
   5á/                 Write 5 / after
      0                Go to the beginning of the line
       5ä$             Copy the text to the end of the line and repeat it 5 times
          Y4P          Copy the line and create 4 new copies
             5x$p      Delete the 5 first characters and put them at the end of the line
                 4Ä    Duplicate this line
                   3äG Duplicate the whole text

```
> 5 votes

# Answer
# Actually, 21 bytes

```
"/\"5*SR6*;4α@R4α+3αi

```

Try it online!

*-1 byte from Adnan*

Explanation:

```
"/\"5*SR6*;4α@R4α+3αi
"/\"5*                 "/\" repeated 5 times
      SR               sort and reverse (result: "\\\\\/////")
        6*             repeat string 6 times (forms one row)
          ;4α          copy and push a list containing 4 copies
             @R4α+     push a list containing 4 copies of the reversed string, append to previous list (now we have one row of diamonds)
                  3α   repeat pattern vertically 2 more times
                    i  flatten and implicitly print

```
> 4 votes

# Answer
# Jelly, ~~17~~ 16 bytes

```
⁾/\ẋ6Wẋ4;U$ẋ3x5Y

```

Try it online!

Thanks to 6710 (miles) for -1 byte.
> 4 votes

# Answer
# J, ~~31~~ ~~28~~ 19 bytes

```
4#_60]`|.\5#72$'/\'

```

## Usage

```
   4#_60]`|.\5#72$'/\'
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 4 votes

# Answer
# APL, 30 bytes

```
A←240⍴'/////\\\\\'⋄24 60⍴A,⊖A

```

I'm quite new to APL, (I'm using APLX, but this should work across most implementations of APL), so this is a quite simplistic solution.

### Explanation:

```
A ← 240 ⍴ '/////\\\\\' ⍝ set A to be a 240 character vector populated with '/////\\\\\'
⋄                      ⍝ statement separator
24 60 ⍴ A,⊖A           ⍝ populate a 24 by 60 character matrix with the concatenation
                          of A and the reverse of A (⊖A)

```
> 4 votes

# Answer
# Python 2, 63 bytes

```
a='\n'.join([('/'*5+'\\'*5)*6]*4);print'\n'.join([a,a[::-1]]*3)

```

For Python 3, do this (65 bytes):

```
a='\n'.join([('/'*5+'\\'*5)*6]*4);print('\n'.join([a,a[::-1]]*3))

```
> 3 votes

# Answer
## Octave, ~~50~~ 48 bytes

Anonymous function:

```
@()repmat([A=repmat(47,4,5) B=A*2-2;B A ''],3,6)

```

You can try online here. Simply run the above command and then run the function with `ans()`.

Essentially this creates an array of the value 47 which is 4 high and 5 wide. It then creates a second array of value 92 which is the same size.

The two arrays are concatenated into a checkerboard of `[A B;B A]`. The `''` is concatenated as well to force conversion to character strings.

Finally the whole array is replicated 3 times down and 6 times across to form the final size.

---

* Saved 2 bytes, thanks @StewieGriffin
> 3 votes

# Answer
# Self-modifying Brainfuck, 91 bytes

```
>>+++[<++++[<++++++[<.....<.....>>-]<<<.>>>>-]++++[<++++++[<<.....>.....>-]<<<.>>>>-]>-]
\/

```

Try it online!

Same as my brainfuck answer, but uses the 3 last characters of the source code instead of generating them at runtime.
> 3 votes

# Answer
## PHP, ~~73~~ 69 bytes

```
for($s='/\\';$i<1440;$i++)echo$i%60<1?'
':'',$s[($i/5+($i/240|0))%2];

```

### Demo

http://ideone.com/z7N1Md
> 3 votes

# Answer
## Vim,  ~~44~~  27 bytes

**EDIT** Lot of bytes won thanks to @DrMcMoylex:

```
5i\<esc>5a/<esc>0y$5PY4P5x$pY3PyGPP

```

---

Original answer:

I'm not sure that really fits the rules of this site but I thought that was fun to try it:

```
i\<esc>59.:s;\v(.{5})\1;\1/////;g<CR>Y4P5x$pY3PyGPP

```

Which can be decomposed like this:

```
i\<esc>                       Insert a \
59.                           Repeat 59 time the insertion
:s;\v(.{5})\1;\1/////;g<CR>   Match 5 characters followed by the same 5 characters
                              And replace them by these 5 characters followed by 5 /
Y4P                           Copy the line and repeat it 4 times
5x$p                          On the current line delete 5 characters and put them
                              at the end of the line
Y3P                           Copy the line and repeat it 3 times
yG                            Copy all the lines
PP                            Repeat them 2 times

```
> 3 votes

# Answer
## APL, 16

```
4⌿5/1↓⍉12 7⍴'\/'

```

Try it on tryapl.org
> 3 votes

# Answer
## Brainfuck, 168 bytes

```
++++++[>++++++++<-]>-<+++++++++[>>++++++++++<<-]>>++<<+++++[>>>++<<<-]>>>>+++[>++++[>++++++[<<<<<.....>.....>>>>-]<<<.>>-]++++[>++++++[<<<<.....<.....>>>>>-]<<<.>>-]<-]

```
> 3 votes

# Answer
# Java 7, 120 bytes

```
String c(){String r="";for(int i=0;i<1440;r+=(i%60<1?"\n":"")+(i/60%8<4?i%10<5?"/":"\\":i%10<5?"\\":"/"),i++);return r;}

```

Pushed everything into one loop. Beats Brainfuck, mission accomplished.

See it online: https://ideone.com/pZjma3
> 3 votes

# Answer
# PHP, ~~142~~ 124 bytes

```
<?=str_replace(['#','-'],['/////','\\\\\\\\\\'],wordwrap(str_repeat(str_repeat("#-",24).str_repeat("-#",24), 4),12,"\n",1));

```

Previous version:

```
<?for($i=1;$i<4;$i++)echo wordwrap(str_repeat("/////\\\\\\\\\\",24),60,"\n",1)."\n".wordwrap(str_repeat("\\\\\\\\\\/////",24),60,"\n",1)."\n";

```

**Output:**

```
C:\PHP\>php this-is-my-pillow.php
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 3 votes

# Answer
# SOML, 20 bytes

```
 /5* \5*+6*6{4{t}5{«

```

Explanation:

```
 /                    push "/", stack: ["/"]
  5*                  repeat it 5 times ["/////"]
     \                push "\" ["/////","\"]
      5*              repeat it 5 times ["/////","\\\\\"]
        +             add together ["/////\\\\\"]
         6*           repeat the string 6 times (it gets long here)
           6{         6 times repeat following code
             4{t}     output 4 times
                 5{«  put the 1st 5 chars at the end of the string

```
> 2 votes

# Answer
# CJam, ~~24~~ 23 bytes

```
"/\\"5e*6*]4*N*_W%]3*N*

```

ONLINE

Thanks 8478 (Martin Ender) for -1.

Explanation:

```
"/\\"5e*6*]4*N*_W%]3*N* Code
"/\\"                   Push "/\\"
     5                  Push 5
      e*                Repeat each
        6               Push 6
         *              Repeat
          ]             Wrap stack from [ to ToS in array
           4            Push 4
            *           Repeat
             N          Push N = "\n"
              *         Join
               _        Duplicate
                W       Push W = -1
                 %      Take every nth item
                  ]     Wrap stack from [ to ToS in array
                   3    Push 3
                    *   Repeat
                     N  Push N = "\n"
                      * Join

```
> 2 votes

# Answer
# Vitsy, ~~28~~ 26 bytes

This can be golfed a bit.

```
'\/'6\[4\[c\[4\[DO]r]aO]r]

```

Try it online!
> 2 votes

# Answer
# Perl, ~~51~~ 50 bytes

Perl 5.10.0+:

```
perl -E 'say+((@_=("/"x5,"\\"x5)x6,$/)x4,(pop@_,@_,$/)x4)x3'

```

Perl before 5.10.0 (52 bytes):

```
perl -e 'print+((@_=("/"x5,"\\"x5)x6,$/)x4,(pop@_,@_,$/)x4)x3'

```

Ungolfed:

```
say(
    (
        (
            @_ = ('/' x 5, '\\' x 5) x 6,
            $/,  # new line symbol
        ) x 4,
        (
            pop(@_),
            @_,
            $/,
        ) x 4,
    ) x 3
);

```

Thanx to @DomHastings for 1 byte.
> 2 votes

# Answer
# Pyth, 24 bytes

```
Jj*4[*6+*5\/*5\\;j*3[J_J

```

Try it!

Explanation:

```
Jj*4[*6+*5\/*5\\;j*3[J_J
   4                     4
      6                  6
         5               5
          \/             "/"
        *                Repeat
             5           5
              \\         "\\"
            *            Repeat
       +                 Concatenate
     *                   Repeat
    [                    List
  *                      Repeat
 j                       Join
J                        Assign copy to J
                ;        Close argument list
                   3     3
                     J   J
                       J J
                      _  Reverse
                    [    List
                  *      Repeat
                 j       Join

```
> 2 votes

# Answer
## MATLAB, ~~58~~ 44 bytes

Thanks to @Stewie Griffin for saving a bunch of bytes ;)

```
[repmat(kron(['/\';'\/'],ones(4,5)),3,6),'']

```

Old version:

~~```
p=@()char(47+45*kron(ones(3,6),kron([0 1;1 0],ones(4,5))))

```~~
> 2 votes

# Answer
## PowerShell v2+, 44 bytes

```
,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3

```

Abuses the crap outta the default `Write-Output` behavior to put a newline between elements.

### Explanation

I'm also trying out a new explanation format, rather than the long prose I traditionally write.

```
,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3
    '/////\\\\\'*6                            # Repeat this string 6 times
  ,(              )*4                         # Repeat it into an array of four elements
                     +                        # Array concatenate with
                      ,('\\\\\/////'*6)*4)    # The same with the slashes the other way
,(                                       )*3  # Repeat it into an array of three elements
                                              # (i.e., 24 total strings)

```
> 2 votes

# Answer
# Pyth, ~~49~~ ~~48~~ ~~40~~ ~~37~~ 34 bytes

```
J60K*24+*5\/*5\\V24:*3+K_K*JN+J*JN

```

OK, I'm just learning Pyth so this is a direct port of my Python answer. Still a lot of golfing to do but it works so I am posting it anyway. Any hints gratefully received :)

1 byte saved with thanks to @Flp.Tkc

-8 by working out how to do it with a variable

-3 by moving the `*24` to the assignment of `K`

-3 by getting rid of the quotes
> 1 votes

# Answer
## C#, 126 Bytes

```
var s="";var c="/";for(int a=0;a<24;){for(int b=0;b<60;)s+=b++%5>0?c:c=="/"?c=@"\":c="/";s+="\n";c=a++%3>1?c=="/"?@"\":"/":c;}

```

`string s` is output. It could be 3 byte less, when it is infinite.

## Ungolfed

```
        var s = "";
        var c = "/";
        for (int a = 0; a < 24;)
        {
            for (int b = 0; b < 60;)//write line
            {
                s += b++ % 5 > 0 ? c : c == "/" ? c = @"\" : c = "/";//Change  /to \ and vice versa after five times
            }
            s += "\n";

            c = a++ % 3 > 1 ? c == "/"? c = @"\" : c = "/" :c; //Change  /to \ and vice versa after three lines
        }

```
> 1 votes

# Answer
# GameMaker Language, 104 bytes

You should make sure that uninitialized variables don't throw an error. This setting is in the main page of Preferences. Otherwise, add `e=''` to the beginning of the program.

```
a="/////"b="\\\\\"d=b+a+b+a+b+a+b c=a+d d+=a for(i=0;i<24;i++)if i mod 8>3e+=d else e+=c e+="#" return e

```

P.S. Yes, each part of the for loop needs an expression. So I can't `for(i=0;i<24;)` and have i++ later.

**Output**

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 1 votes

# Answer
# C++ 138

```
void P(){int i,j,k,l;for(i=0;i<3;i++)for(j=0;j<8;j++)for(k=0;k<12;k++)for(l=0;l<5;l++)cout<<((j/4)?(k%2)?'/':'\\':(k%2)?'\\':'/')<<'\n';}

```

**Ungolfed**

```
#include<conio.h>
#include<iostream>
using namespace std;

void P()
{
    int i,j,k,l;
    for(i=0;i<3;i++)
        for(j=0;j<8;j++)
            for(k=0;k<12;k++)
                for(l=0;l<5;l++)
                    cout<<((j/4)?(k%2)?'/':'\\':(k%2)?'\\':'/')<<'\n';
}

int main()
{
    P();
    _getch();
    return 0;
}

```
> 1 votes

# Answer
# Lithp, 166 characters

Line split for readability.

```
#::((def x #S,N::(invoke S repeat N))(var A (x "/" 5))(var B (x "\\" 5))
(var C (+ (x (+ A B) 6) (nl)))(var D (+ (x (+ B A) 6) (nl)))
(print (x (+ (x C 4) (x D 4)) 5)))

```

Sample usage:

```
% pillow.lithp
(
    (def f #::((def x #S,N::(invoke S repeat N))(var A (x "/" 5))(var B (x "\\" 5))(var C (+ (x (+ A B) 6) (nl)))(var D (+ (x (+ B A) 6) (nl)))(print (x (+ (x C 4) (x D 4)) 5))))
    (f)
)

```

Run with:

```
./run.js pillow.lithp

```

This is a fairly simple solution that repeats characters. There is no standalone `repeat` function yet, so `invoke` is used to call `"string".repeat(N)` and adds a bit to the count.
> 1 votes

# Answer
## GolfSharp, 59 bytes

```
r(0,1440).s(n=>n%10<5^n%480<240?"\\":"/").j().S(60).j("\n")

```
> 1 votes

# Answer
# Befunge-98, 76 bytes

```
'/\::2%0`!\4c*/2%0`!-> #0 #\ #\' $ #\_\3k:4k,1+:c%0`!> #0 #, #a_:cad+*\`!#@_

```

TryItOnline!

String processing/generation can be difficult with only a stack available...

A couple bytes may be able to be shaved off here or there, but I beat brainfuck, so I'm happy.

## Explanation

```
Push '/' on the stack
Swap top two (at the beginning, zero will now be on top). Call top = iterator = n
Calculate (n % 2 == 0) != ((n / 48) % 2 == 0)
If true, swap top two, replace '/' with '\', swap again
Swap top two (so that we now have the character to print on top, followed by n)
Duplicate the char 4 times, and print 5 times
Increment n
If n % 12 == 0, print a newline character
If !(288 > n), end, else repeat

```
> 1 votes

# Answer
## Ruby, 83 + 14 = 97 bytes

```
puts Zlib.inflate Base64.decode64"eNrTB4EYECCdxTVENSP4pLOGqubhE8+j8Twaz6PxDAA3Pofw"

```

Add 14 bytes for `-rzlib` and `-rbase64` flags.
> 1 votes

# Answer
# Julia, 56 bytes

```
a="////\\\\\\\\"^6*"\n";print((a^4*a[[48:-1:1,49]]^4)^3)

```
> 1 votes

# Answer
# , 72 bytes

```
write(matrix(c(x<-rep(rep(c('/','\\'),e=5),24),rev(x)),24,60),'',60,,'')

```

builds a matrix of appropriate characters and writes it to stdout.

Try it online!
> 1 votes

# Answer
# T-SQL, 113 bytes

```
DECLARE @ INT=0L:IF @%8<4PRINT REPLICATE('/////\\\\\',6)ELSE PRINT REPLICATE('\\\\\/////',6)SET @+=1IF @<24GOTO L

```

Formatted:

```
DECLARE @ INT=0
L:
   IF @%8<4 PRINT REPLICATE('/////\\\\\',6)
   ELSE PRINT REPLICATE('\\\\\/////',6)
   SET @+=1
IF @<24 GOTO L

```

Using both string literals seems to be the shortest option, trying to `REPLICATE(REPLICATE('/',5)+REPLICATE('\',5)` is way longer, as is using additional variables.
> 1 votes

# Answer
# SOGL V0.12, 11 bytes

```
└5*5∙╬¡6*3∙

```

Try it Here!

Explanation:

```
└            push "/"
 5*          repeat 5 times
   5∙        repeat vertically 5 times
     ╬¡      quad-palindromize with 0 overlap and mirroring characters
       6*    multiply 6 times horizontally
         3∙  multiply 3 times vertically

```
> 1 votes

# Answer
# Jstx, 21 bytes

```
♣/►\:►/;1BO♠/♦/!41o16

```

Not the shortest solution but I wanted to try this interesting challenge.

Explanation

```
♣  # Push literal 5
/  # Enter an iteration block over the first stack value.
►\ # Push literal \
:  # Push the sum of the second and first stack values.
►/ # Push literal /
;  # Push the difference of the second and first stack values.
1  # End an iteration block.
B  # Push five copies of the first stack value.
O  # Collapse all stack values into a string, then Push that string.
♠  # Push literal 6
/  # Enter an iteration block over the first stack value.
♦  # Push literal 4
/  # Enter an iteration block over the first stack value.
!  # Push a copy of the first stack value.
4  # Print the first stack value, then a newline.
1  # End an iteration block.
o  # Push the first stack value with characters in reverse order.
1  # End an iteration block.
6  # Ends program execution.

```

Try it online!
> 1 votes

# Answer
## Pip `-n`, 24 bytes

```
(RF('/X6.'\X6)X24)X3<>72

```

Quad reflect is a bit weird in pip, so this answer uses normal reflect.

The -n flag joins lists with newlines.

Try it online!
> 1 votes

# Answer
# MAWP, 88 bytes

```
3[4[6[5[68W1A;1A]%4[68W2A2W;1A]%1A]%52W;1A]4[6[5[68W2A2W;1A]%4[68W1A;1A]%1A]%52W;1A]%1A]

```

Try it!

Raise the max executions to at least 15000 to test it :D Oh, and be ready to wait for quite some time for it to finish.

# MAWP 2.0, 61 bytes

```
3[4[6["/////\\\\\":1-]`10;1-]`4[6["\\\\\/////":1-]`10;1-]`1-]

```

Try it!
> 1 votes

# Answer
# x86-16 machine code, IBM PC DOS, 40 bytes

Binary:

```
00000000: b85c 2fb1 18b3 0cf6 c103 7502 86e0 ba05  .\/.......u.....
00000010: 00cd 294a 75fb 86e0 4b75 f350 b00d cd29  ..)Ju...Ku.P...)
00000020: b00a cd29 58e2 dec3                      ...)X...

```

Listing:

```
B8 2F5C         MOV  AX, '/\'       ; the two chars
B1 18           MOV  CL, 24         ; CX = row counter
            ROW:
B3 0C           MOV  BL, 12         ; BX = pattern counter
F6 C1 03        TEST CL, 3          ; have displayed 4 lines of same direction?
75 02           JNZ  DIR            ; if not, continue with same
86 E0           XCHG AH, AL         ; otherwise, swap the chars
            DIR:
BA 0005         MOV  DX, 5          ; DX = char counter
            PATT:
CD 29           INT  29H            ; write char to console
4A              DEC  DX             ; have displayed 5 of the same?
75 FB           JNZ  PATT           ; if not, keep writing
86 E0           XCHG AH, AL         ; otherwise, swap the chars
4B              DEC  BX             ; have displayed 12 patterns on a line?
75 F3           JNZ  DIR            ; if not, keep writing patterns
50              PUSH AX             ; otherwise, save the chars and write a newline
B0 0D           MOV  AL, 0DH        ; CR char
CD 29           INT  29H            ; write to console
B0 0A           MOV  AL, 0AH        ; LF char
CD 29           INT  29H            ; write to console
58              POP  AX             ; restore original chars
E2 DE           LOOP ROW            ; loop until written 24 lines written
C3              RET                 ; return to DOS

```

A standalone PC DOS executable COM program. Output to console:
> 1 votes

# Answer
# Nibbles, 13 bytes

```
^3`<^4`:;^6`<^5"/\\"\$

```

explanation

```
^3                     # replicate 3 times
  `<                   # sort
    ^4                 # replicate 4 times
      `:               # list of two lists (for getting newlines)
        ;              # let (save value to $)
         ^6            # replicate 6 times
           `<          # sort
             ^5        # replicate 5 times
               "/\\"   # the string /\
                    \$ # reverse the saved value

```

Note that that last $ can't be omitted because in the binary form the sort needs to place more data after its arg
> 1 votes

# Answer
# Charcoal, 26 bytes

```
ＵＯ⁵¦⁴/‖Ｍ↓→‖Ｍ↓→‖Ｍ‖ＢＯ²⁰‖ＢＯ↓⁸

```

Try it online! Link is to verbose version of code.

Explanation:

```
ＵＯ⁵¦⁴/  - drawing a 5 by 4 rectangle filled with /
‖Ｍ↓→            - reflect and mirror the canvas to the down and right direction (note that for this pattern order doesn't matter)
‖Ｍ             - reflect mirror without a argument (default is to the right, n times)
‖ＢＯ²⁰         - reflect butterfly overlap which would reflect the same thing n times to the left by default
‖ＢＯ↓⁸        - 8 characters but this time with a given direction which is down

```

Optimizing: -9, Thanks to @Neil for the help on reflects.
> 1 votes

# Answer
## Batch, 132 bytes

```
@set s=/////\\\\\
@set s=%s%%s%%s%%s%%s%%s%
@set s=%s% %s:~5%/////
@for %%s in (%s% %s% %s%)do @for /l %%i in (1,1,4)do @echo %%s

```

Works by building up the two types of row, then looping through six rows four times per row.
> 0 votes

# Answer
# Swift 3, ~~100 99~~ 97 bytes

```
var a="/////",b="\\\\\\\\\\",c=""
(1...144).map{c+=a+b+($0%6<1 ?"\n":"")
$0%24<1 ?swap(&a,&b):()}

```

Could save 1 byte if `Swift` `print` function did not add a newline by default.

**Edit 1:**

Saved 1 byte by changing the if to ternary

`if(i%24<1){swap(&a,&b)}` -\> `i%24<1 ?swap(&a,&b):()`

**Edit 2:**

Changed from `for` to `map` over the `CountableClosedRange`
> 0 votes

# Answer
## Racket 156 bytes

```
(define g #t)(for((k 24))(for((i 12))(for((j 5))(display(if g "/""\\")))(set! g(if g #f #t)))
(when(= 0(modulo(add1 k)4))(set! g(if g #f #t)))(displayln""))

```

Ungolfed:

```
(define(f)
  (define g #t)
  (for ((k 24))
    (for ((i 12))
      (for ((j 5))
        (display (if g "/" "\\")))
      (set! g (if g #f #t)))
    (when (= 0 (modulo (add1 k) 4))
      (set! g (if g #f #t)))
    (displayln "")))

```

Testing:

```
(f)

```

Output:

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 0 votes

# Answer
# Java 7, 148 bytes

```
String c(){String r,z,y=z=r="",p="/////\\\\\\\\\\",q="\\\\\\\\\\/////";int i=0;for(;i++<6;y+=p,z+=q);for(i=0;i<24;r+=(i++%8<4?y:z)+"\n");}return r;}

```

**Ungolfed & test code:**

Try it here.

```
class M{
  static String c() {
    String r, z, y = z = r = "",
           p = "/////\\\\\\\\\\",
           q = "\\\\\\\\\\/////";
    int i = 0;
    for(; i++ < 6; y += p, z += q);
    for(i = 0; i < 24; r += (i++%8 < 4 ? y : z)+"\n");
    return r;
  }

  public static void main(String[] a){
    System.out.println(c());
  }
}

```

**Output:**

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 0 votes

# Answer
# PHP, 55 bytes

```
for(;$i<1440;)echo"/\\"[($i/5^$i/240)&1],"\n"[++$i%60];

```

toggles between forward and backward slash every 5 characters, inverted every 240 characters;
not counting newlines; newlines inserted every 60 characters.

has one trailing newline. Run with `-r`.

---

**recursive program** for 66 bytes:

```
<?="/\\"[($i/5^$i/240)&1]."\n"[++$i%60];if($i<1440)include"p.php";

```

save to file `p.php`; call from CLI (or insert `($i?"":"<pre>").` after `<?=`)
> 0 votes

# Answer
# Python 2, ~~83~~ 55 bytes

```
x=('/'*5+'\\'*5)*6;print((x+'\n')*4+(x[::-1]+'\n')*4)*3

```

Try it online!

-28 bytes thanks to Leaky Nun
> 0 votes

# Answer
# Python 3, 60 bytes

Lots of multiplying strings!

```
print((((('/'*5+'\\'*5)*6+'\n')*4)+(('\\'*5+'/'*5)*6+'\n')*4)*3)

```

**Output**

```
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

```
> 0 votes

# Answer
# Powershell, 77 bytes

I must say I thought this would be easier with PowerShell, but it's quite hard to create something more condense than this.

`$a=@("/","\");"$(1..6|%{1..3|%{1..6|%{$a[$b]*5;$a[!$b]*5};"`r`n"}; $b=!$b})"`

More readable:

```
$a=@("/","\")
"$(1..6|%{
    1..3|%{
     1..6|%{
     $a[$b]*5
     $a[!$b]*5
        }
     "`r`n"}
    $b=!$b})"

```

I'm using the index numbers of the array in order to decide whether I should put `\` or `/` and between every loop I simply toggle the variable.
> 0 votes

# Answer
# tcl, 97

```
proc r s\ n {string repe $s $n}
puts [r [r [r /////[r \\ 5] 6]\n 4][r [r [r \\ 5]///// 6]\n 4] 3]

```

---

My try to outgolf myself didn't go well :( :

# tcl, 102

```
proc r s\ n {string repe $s $n}
proc R s\ t {r [r [r $s 5][r $t 5] 6]\n 4}
puts [r [R / \\][R \\ /] 3]

```

runnable on: http://rextester.com/live/HURDH99224
> 0 votes

# Answer
## Pyth, ~~21~~ 20 bytes

```
J*6S*5"/\\"V6V4J)=_J

```

Try it online!

Python 3 translation:
```
J=6*sorted(5*"/\\")
for N in range(6):
    for N in range(4):
        print(J)
    J=J[::-1]

```
> 0 votes

# Answer
# Excel (loaded with VBA), 70 62 bytes

Formula for each cell (A4 through BH27):

```
=IF(SIN(COLUMN()*0.62)*SIN(ROW()*0.8)>0,"\","/")

```

I'm not sure how to score this and I couldn't find a consensus. It's a 48 byte pure Excel formula, the same in every cell (but of course the fact that it should be in a particular range is also information). It takes 62 bytes to load it by executing this in the VBA Immediate window.

```
[A4:BH27]="=IF(SIN(COLUMN()*.62)*SIN(ROW()*.8)>0,""\"",""/"")"

```

# Output
> 0 votes

# Answer
# Add++ `-i`, 27 bytes

```
L,"/\"5€*6*b]4*d€bR+3*bUBJn

```

Try it online!

The `-i` flag simply invokes the function with a clean stack and then outputs its return value.

## How it works

```
L,		; Anonymous function
	"/\"	; Push this string			STACK = ["/\"]
	5€*	; Repeat each character 5 times		STACK = [["/////" "\\\\\"]]
	6*	; Repeat the array 6 times		STACK = [["/////" "\\\\\" "/////" "\\\\\" "/////" "\\\\\" "/////" "\\\\\" "/////" "\\\\\" "/////" "\\\\\"]]
	b]4*	; Repeat the whole thing 4 times	STACK = [[["/////" "\\\\\" ... "/////" "\\\\\"]]]
	d	; Duplicate				STACK = [[["/////" "\\\\\" ... "/////" "\\\\\"]] [["/////" "\\\\\" ... "/////" "\\\\\"]]]
	€bR	; Reverse the second copy		STACK = [[["/////" "\\\\\" ... "/////" "\\\\\"]] [["\\\\\" "/////" ... "\\\\\" "/////"]]]
	+	; Concatenate				STACK = [[["/////" "\\\\\" ...] ... [... "\\\\\" "/////"]]]
	3*	; Repeat 3 times			STACK = [[["/////" "\\\\\" ...] ... [... "\\\\\" "/////"]]]
	bUBJn	; Concatenate and grid			STACK = ["/////\\\\\...\\\\\/////"]

```
> 0 votes

# Answer
# Vyxal, 16 bytes

```
‛/\5*s6(4(:6*,)Ṙ

```

Try it Online!

Do not worry, your pillow will be remembered.

```
‛/\              # String `/\`
   5*            # times 5
     s           # Sort
      6(         # Six times
        4(    )  # Four times
          :      # Duplicate
           6*    # 6 lots
             ,   # Output
               Ṙ # Reverse

```
> 0 votes

---
Tags: code-golf, ascii-art, kolmogorov-complexity
---


# Question
Title: Hello, World! with semi-common characters
As some of you may know, to get a language onto Dennis's wonderful Try It Online!, a Hello, World! program is required. Recently, Dennis pushed up a way to load these programs from the website. Here is a JSON pastebin of the characters used in those programs, by frequency, as of July 27, 2017.

Some of those characters need some love, so your challenge is to output Hello, World! (preferably in a language involved in this process), using only the characters specified below. These characters are all of the characters used between `10` and `99` (inclusive) times, along with the two most common characters, `0` and , because I'm feeling nice.

```
0 $&*?ABCDEFGIJKLNPQRSTUXYZ\`gjkqwxyz{}÷≤≥=║_

```

Your usage of the character should be based on its appearance in a normal program, not based on its code point or byte value.

You must use at least one character from that set, so 0-length programs are invalid.

This is , so shortest answer in bytes wins.

JSFiddle to check if your answer is valid

# Answer
# SOGL V0.12, ~~89~~ ~~75~~ 68 bytes

```
z{}xxxx≥x≥x≥xXUqXxq≤qq≤q *R_IIRq  q *R_I0II*IRqxXq≤qxqxq CR_0II÷Rq0*

```

Try it Here!
Note: whenever `q` or output is referred to here, it doesn't pop as popping output (any of `oOpP`) are unavailable or output a prepending newline.

Explanation (outdated, what's changed is that the "H" is printed using the alphabets letters):

```
 $             push "$"
  R_           convert to an array of ordinals, then push all the contents to the stack
    0II        push 0+1+1 = 2
       *       multiply by that
        R      convert to character
         q     output
          z    push the lowercase alphabet
           {}  iterate over it, pushing each char, and do nothing. Stack: ["H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
stack manipulation:
 xxxx ["H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r"]
 ≥    ["r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"]
 x    ["r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o"]
 ≥    ["o","r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n"]
 x    ["o","r","H","a","b","c","d","e","f","g","h","i","j","k","l"]
 ≥    ["l","o","r","H","a","b","c","d","e","f","g","h","i","j","k"]
 xxx  ["l","o","r","H","a","b","c","d","e"]
 q    output the "e"
 ≤    ["o","r","H","a","b","c","d","e","l"]
 qq   output the "l" twice
 ≤    ["r","H","a","b","c","d","e","l","o"]
 q    output the "o"

*                       push "*",
 R_                     convert to an array of ordinals, then push all to stack
   II                   increase by 2
     R                  convert back to character
      q                 output
         q              push a space, then output
           *            push "*"
            R_          convert to an array of ordinals, then push all to stack
              I         increase that
               0II      push 0+1+1 = 2
                  *     multiply
                   I    increase
                    Rq  output as character
stack manipulation: (starting stack: ["r","H","a","b","c","d","e","l","o",","," ","W"])
 x  ["r","H","a","b","c","d","e","l","o",","]
 X  ["r","H","a","b","c","d","e","l","o"]
 q  output the "o"
 ≤  ["H","a","b","c","d","e","l","o","r"]
 q  output the "r"
 x  ["H","a","b","c","d","e","l"]
 q  output the "l"
 x  ["H","a","b","c","d"]
 q  output the "d"

C            push "C"
 R_          convert to ordinal as before
   0II÷      floor divide by 2
       Rq    output as character
         0*  multiply by 0 so nothing extra would be outputted

```

Fun fact: all of the characters from the allowed characters are in SOGLs codepage :D
> 6 votes

# Answer
# Perl 5, 76 bytes

```
}{${$_=$`x?B?}{?\w$?}{$_=qq{Lg\LLL$&= w$&RLD=}&qq=y}\LLL$&L _$&RLDA=}=$_=\*G

```

This uses a feature that has been deprecated, but works locally in my terminal (which is version 5.18.2 as noted). In older versions of Perl `?\w?` is a synonym for `/\w/` which gives me access to regexp matching and I have enough chars for `$&` (last match) and `$`` (text preceding last match). I need these to be able to get the `O`. I generate this be creating a `glob` reference (`$_=\*G` which, cast to a scalar, is something like `GLOB(0x7ffb728028d0)`). Once that's in `$_`, `?B?` will match the `B` and `$`` will contain `GLO`, I can then match against `\w$` which would store `O` in `$&` which is inserted into the strings that I'm running stringwise-AND to create the rest of the text, the body of the string is lowercased using `\L`.

Try it online! \- uses `/\w/` in place of `?\w?` as the version of Perl on TIO is too new.

---

# Perl 5, 65 bytes

This is a bit more cheaty as it relies on the filename on TIO (which is `.code.tio`), so I don't really think this is competing, but I was happy with the result!

```
}{${$_=$0}{?\w$?}{$_=qq{Lg\LLL$&= w$&RLD=}&qq=y}\LLL$&L _$&RLDA=}

```

Try it online!
> 25 votes

# Answer
# Unary, 7\*10182 bytes

Unary is Brainfuck converted to binary converted to unary using `0` as the counter. Essentially, it condenses a Brainfuck program into a number and the output is that number of `0`s. They are usually very large programs.

I won't paste the program here because I don't know how much text SE allows but I bet it's less than this. Instead, I'll paste the precise number of zeroes in this answer:

```
708184005756841022918598670049178934705323143517361395031673227349803938380119378597780037353721967636097362645175347036417214959141923667629285233360306016978751166690464736541968556

```

As this is a fairly cheap answer, guaranteed to not be the shortest, and I simply copied it, I'm making this a wiki post.
> 11 votes

# Answer
# 05AB1E, ~~137~~ ~~106~~ 95 bytes

```
X00X00DXX00DXX00XX0X0X00D0XXXX0X00X00XXX00XXX0XXXXXX00XXXXX0XXXX00D0X000DD00XXJC000gDD0000g***B

```

Try it online!

-31 thanks to @Adnan for pointing out I could use base 108.

-?? thanks to @Riley for pointing out some things wrong.

---

***Old version (different method):***

# 05AB1E, ~~211~~ ~~186~~ 166 bytes

```
0g00g000000000gUX000000gXX00000g000g00g000gD0000g0 000g00000gX00000gX00000g0 00000g00000000g0000000g00g00000000gD000000gX0000000g0g00000gUXJX00000000000000000g000g**B

```

Try it online!

---

Haha! AND HERE I THOUGHT ESOLANGS STOOD NO PLAUSIBLE CHANCE!

---

**First we get 255 stored in X:**

```
00g               # Push 2 (length of 00).
   00000g         # Push 5 (length of 00000).
         00000g   # Push 5.
               JU # Join to 255 and store in X.

```

**Then, using the same length trick we push: `1296995323340359595058728869715`**

```
0g00g000000000g000000g000000000g000000000g00000g000g00g000g000g0000g0 000g00000g000000000g00000g000000000g00000g0 00000g00000000g0000000g00g00000000g00000000g000000g000000000g0000000g0g00000gJ

```

Where we just use `0<space>` instead of the length trick for the zeros.

**Then, finally, we push the 255 we stored and convert from 255 to base 10**:

```
X  # Push stored 255.
 B # Convert to base 255.

```

---

Still golfing using the other allowed chars, and duplication, it will be a minute.
> 10 votes

# Answer
# Moorhens (v2.0), ~~3423~~ ~~983~~ ~~923~~ ~~866~~ ~~749~~ 716 bytes

I think this can be golfed a bit, Moorhens is not an easy language to work with.

```
xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU KA AA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU KA KA xU xU xU AA AA AA AA AA KA xU AA KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU KA XI XI XI XI XI XI KA XI XI XI XI XI XI XI XI AA AA AA AA AA AA AA AA AA AA AA AA

```

## Explanation

Moorhens is a language based of of dictionary words. Each word corresponds to an operation based on its hash. The five operations used here are `xU`, `ER`, `XI`, `KA`, and `AA`

* `xU` increments the TOS
* `ER` puts a new zero on the stack.
* `XI` decrements the TOS
* `KA` duplicates the TOS
* `AA` rolls the TOS to the bottom

We push each letter with sucessive applications of these operations.
> 8 votes

# Answer
# Beatnik, 148 bytes

```
K QQQQQQQG ZD XA K QQJA KD ZD XA K KG KD ZD ZD ZD XA XA K B KD ZD XA K QQQQF ZD ZD XA K QQQD XA K A Z KD XA ZD XA K B KD XA ZD XA K J Z XA K QQQB XA

```

Try it online!

## Explanation

Beatnik bases the instruction executed based on the scrabble score of the word. Here's a shortened explanation:

```
Code         Scrabble Score   Explanation

K            5                push the scrabble score of the next word
QQQQQQQG     72               72 ['H']
ZD           12               pop a value; push it back twice
XA           9                pop a value; print its ASCII character
KD           7                pop two values; push their sum
Z            10               pop two values; push their difference

```
> 8 votes

# Answer
# Glypho, 480 bytes

```
AABCABABABBAABABAABCABBAABABABBCABBAABABABABABABABBAABBAABABABABABABABBAABBAAABCABBAABABAABCAABCABBAABABABBCABABABBAABBAABABAABCAABCABBAAABCABBAABABABBAABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABAAABABAABAABBAABCAABABABBAABBAAABCAABCABBAABABABBCABABABBCABABABBAABAAABABAABAABABABBAABABABBAABABABAAABABAABAABBAABABABBAAABCABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABCAABAAABABAABAABBAABABABBCAABCABBAAABCAABCABBAAABCABBAABABABBAABABABBCABABABBAABAAABABABCAABBAAABAABACABBBABCB

```

Try it online!
> 5 votes

# Answer
# Double JavaScript, 318 bytes

I'm not sure if that's allowed, I couldn't do it using the JavaScript interpreter once. It's similar to use `eval()` but instead I'm using the interpreter twice: (Try it in the console to get the result printed back)

```
`\`\\x${0xA*0xA&0xC}${0xA&0xC}\\x${0xA*0xF&0xF}${0xB*0xF&0xF}\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}F\\x${0xE*0xF&0xF}C\\x${0xE*0xF&0xF}${0}\\x${0xB*0xF&0xF}${0xB*0xB*0xF&0xF}\\x${0xA*0xF&0xF}F\\x${0xB*0xB*0xF&0xF}${0xE*0xF&0xF}\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}${0xA*0xA&0xC}\\x${0xE*0xF&0xF}${0**0}\``

```

Try it online!

Evaluates to:

```
`\x48\x65\x6C\x6C\x6F\x2C\x20\x57\x6F\x72\x6C\x64\x21`

```

Try it online!

Which evaluates to `Hello, World!`
> 5 votes

# Answer
# Headsecks, 78 bytes

```
yyzyzzxNxNzx{yyy{y{y{yzzz_{_zzyy\zxxxxxx\zzy\\zz\zx\{{\{{\zzz\xxx\{{\{{y\zzzx\

```
> 4 votes

# Answer
# Smallf\**k, 266 bytes:

```
zJ$NJ`ZZx*gQYQQ{zqyKKUkUR?AS`zB`JB&UCKCIxQ_G0*000FzzJ&?YwkC\qqgZ`xYQyC}DgY_&_S}KPZ\&?SGAE&{Gw_w} GAgA{qT{gC&`qI?xwCNQwgR}?{*QEwQUj&BT&jR__IJJIqUqAPF0yICXESL?AYR QIAFU& yYwE&$\Njj B0T*F j$?kCzQk*}U}UgI$}Ew_yDL`qYI*E_G}SCjXDFNJKGNIGyIwA\BzLP`*zCILGCNqyYZyq? GwN{q{gKSj

```

Actually, the characters are kinda irrelevant. It's just a matter of whether or not each character has an even codepoint or an odd codepoint. Thus, I've made an effort to use every character available (except the multibyte characters) (though since it was randomised, I didn't make an effort to guarantee that).
> 3 votes

# Answer
# Pyke, ~~133~~ 144 bytes

```
? BXKKKKRKRKRK\CkJ00q}}}XEjTX}G_E\E\L\LkJjRT}}XRGREkJjR 00q}R? B_RE\ \wkJjRT}}XRGRE\R\L\DkJjRZ0q}}R? B_RER? JR? KREZjZ0q}AREkJjRT}}RG_RE00q}}RAA

```

Try it online!

A horrible mess of code that can almost certainly be shortened... Constructs it one character at a time.

```
? BXKKKKRKRKRK\CkJ - ".C" - A string that when evaled, gets the character at the point
00q}}}XEj - Construct 64 by doing `((0==0)*2*2*2)**2` and then eval, getting the "@" character and store it in `j`
TX}G_E - Get "h" using `@` by looking it up in the alphabet
\E\L\LkJ - "hELL"
jRT}}XRGREkJ - "hELLo"
jR 00q}R? B_RE  - ","
\ \wkJ - "hELLo, w"
jRT}}XRGRE\R\L\DkJ - "hELLo, woRLD"
jRZ0q}}R? B_RER? JR? KREZjZ0q}AREkJ - "hELLo, woRLD!"
jRT}}RG_RE00q}}RAA - "Hello, World!"

```
> 3 votes

# Answer
# Vyxal, 33 bytes

```
`gDKKN`\*kP*JkP*` w`J`NQKCZ`kP*JN

```

Try it Online!

As I've golfed this, it's become a lot more straightforward. For reference, the original looked something like this.

For convenience, the string is constructed swapcase'd, then fixed at the end.

This program makes heavy use of `kP*` \- `*` in this context is ring translate, and `kP` printable ASCII, which is arranged a bit weirdly.

```
       \*kP*                      # The character `+`, made by ring translating `*`
`gDKKN`     J                     # Append that to `gDKKN`
             kP*                  # Ring translate again, producing `hELLO,`
                ` w`J             # Append ` w`
                     `NQKCZ`kP*   # The string `NQKCD` ring translated to `ORLD!`
                                  # Don't ask why Z wraps to `!`
                               JN # Append that and swap the case.

```
> 3 votes

# Answer
# dc, ~~164~~ 162 bytes

```
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzS zzS?zzzzzzzzzzzzS$zzzzzzzzzzzzzzzzzzzzzzzzzzzzzPzzzzzzzzzzzzzzzzSwzzzzzzzzzzzzzzzPzzzzzzzzSLzPzPzzzzPL$PL PLwPzPzzzzPLLPAI*PL?P

```

Try it online!

There's likely a better/more interesting approach. I tried using the ASCII+256 trick that `dc` has, but that outputs additional characters as well (even if they're non-printing), and once I got to 'o', the wonderfully prime 111, I ran into trouble even getting a value of 111+(multiple of 256) that factored cleanly. So here's a fairly straightforward (albeit golfed where possible) solution:

In `dc`, `z` is a command that pushes the stack depth onto the stack. That means we can use it as an increment. This is how I create most of my ASCII values for this challenge (printed with `P`), which I push onto named stacks with `S` and pop back onto the main stack with `L`.

`dc` lets you use the hex values A-F even when the input radix is decimal (default). ~~Luckily, our first letter, 72, is a multiple of 12, so I save a byte or two here by multiplying 6\*12 and printing immediately (`zzzzzzzC*P`).~~ My 164-byte version used multiplication early on to get 72 ('H'), which was mildly clever but a holdover from an earlier attempt, and a waste of bytes. Now, I start by incrementing and saving the space, the exclamation point, and the comma, which are out of order, and therefore can't be printed yet. Next, I come to the 'H', which I print immediately, before I get to 'W', which I must save for later.

I simply print when I hit the 'e', then I increment up to 'l'. I print two of those and save one. When I make it to 'o', I first thought I'd have to save one of those for later, but everything is *kind of* in order at this point. I print an 'o', retrieve my comma, space, and 'W' from earlier, and now I'm right back to 'o'. I print this, and increment a few up to the highest necessary value, 'r' (114), which I print before loading and printing the 'l' I tucked away earlier.

Almost done! 'd' is ASCII value 100, which is easily made by multiplying 10\*10 (fewer bytes than having stored it earlier and loading it now). Hex value `A` is 10, as is our input radix which we can retrieve with the command `I`. Multiply those, print, and then load and print our exclamation point from earlier. Hello, World!
> 2 votes

# Answer
# Deadfish~

```
w

```

Honestly, the other answers are way more impressive.
> 1 votes

---
Tags: code-golf, restricted-source, hello-world
---


title: Draw an ASCII Grid

text:
# Question
Title: Draw an ASCII Grid
(Based on this closed challenge, related)

Given an integer n \> 1, draw a grid composed of the characters: "-" "+" and "|". However, since I want the grid to look nice, the horizontal component should be 2 wide.

Trailing spaces for each line are not required.

#### Examples:

n = 2

```
  |
--+--
  |

```

n = 3

```
  |  |
--+--+--
  |  |
--+--+--
  |  |

```

This is , so the shortest answer in bytes wins!

# Answer
# Python 3, 49 bytes

```
lambda n:f'\n{"--+"*~-n}--\n'.join(['  |'*~-n]*n)

```

Try it online!
> 12 votes

# Answer
# JavaScript (ES6),  ~~67~~  66 bytes

Recursive.

```
f=(n,k=n*2*(n*=3)-n)=>k--?` -|+
`[k%n?~-k%n%3&2|k/n&1:4]+f(n,k):''

```

Try it online!

---

# JavaScript (ES6),  ~~61~~  58 bytes

*Saved 3 bytes thanks to @EliteDaMyth*

The straightforward way.

```
n=>`${s='  |'[R='repeat'](--n)}
${'--+'[R](n)}--
`[R](n)+s

```

Try it online!
> 9 votes

# Answer
# Python 3, ~~70 62 60~~ 58 bytes

```
lambda n:f"-{'-+-'*~-n}-\n".join([f" {' | '*~-n} \n"]*n)

```

Thanks to @Underslash, @Jonathan Allan for removing 4 bytes.
> 9 votes

# Answer
# Jelly, 14 bytes

```
“+--“|  ”ẋḊ¥⁺€

```

Try it online!

-2 bytes thanks to Jonathan Allan

Returns a matrix of characters.

```
“+--“|  ”ẋḊ¥⁺€  Main Link
“+--“|  ”       ["+--", "|  "]
           ¥    Apply last two to a list and X
         ẋ      Repeat the list X times
          Ḋ     Remove the first element
             €  To each row,
            ⁺   Do the above

```
> 8 votes

# Answer
# Charcoal, 16 bytes

```
ＵＯ⊖×³Ｎ⊖⊗θ  |¶--+

```

Try it online! Link is to verbose version of code. Explanation:

```
ＵＯ

```

Draw a rectangle...

```
⊖×³Ｎ

```

... width `3n-1`...

```
⊖⊗θ

```

... height `2n-1`...

```
  |¶--+

```

... filled with  `|` and `--+` on alternate lines.
> 8 votes

# Answer
# Vyxal `rj`, 15 bytes

```
`+--|  `½*ẋfḢvḢ

```

Try it Online!

Port of hyper-neutrino's Jelly answer
> 8 votes

# Answer
# Haskell, 42 bytes

```
n%a=tail$[1..n]>>a
f n=n%[n%"+--",n%"|  "]

```

Try it online!

Defines `f :: Integer -> [String]`.

`[1..n]>>a` means: for each element of `[1..n]`, cycle through all elements of `a`. Then, `tail` removes the first one. So `3%"+--"` evaluates to `"--+--+--"`.

`%` does double duty, first acting on `String`s to make the two grid rows, and then on `[String]` to transform them into whole grid.

(The tempting 39-byte `f n|g<-tail.([1..n]>>)=g[g"+--",g"| "]` is thus foiled by the monomorphism restriction.)
> 8 votes

# Answer
# Excel, 62 bytes

```
=LEFT(REPT(IF(MOD(SEQUENCE(2*A1-1),2),"  |","--+"),A1),3*A1-1)

```

With gridlines turned off, it looks the same as the single string with line feeds.
> 7 votes

# Answer
# Ruby, 37 bytes

```
->n{['  |'*~-n]*n*"
#{['--']*n*?+}
"}

```

Try it online!

### Ruby, 37 bytes

A very similar approach, also 37 bytes:

```
->n{['  |'*~-n]*n*"
#{'--+'*~-n}--
"}

```

Try it online!
> 7 votes

# Answer
# APL, 44 bytes

```
{1 1↓⊃⍪/,/⍵ ⍵⍴⊂2 3⍴'+--|  '}

```

`2 3⍴'+--| '` gives:

```
+--
|

```

`⍵ ⍵⍴⊂2 3⍴'+--| '` gives n×n tiles, and `⍪/,/` joins them together. For example n = 3:

```
 +--+--+--
 |  |  |
 +--+--+--
 |  |  |
 +--+--+--
 |  |  |

```

And finally `1 1↓⊃` discloses and drops the first column and row.

```
  |  |
--+--+--
  |  |
--+--+--
  |  |

```

Works in both Dyalog APL and GNU APL.

Try it online!
> 7 votes

# Answer
# Vyxal `j`, 19 bytes

```
:`+--``|  `"*$ẋfḢvḢ

```

Try it Online!

Ports my Jelly answer. I'll stop for a bit to give other people time to answer.

```
:`+--``|  `"*$ẋfḢvḢ  Full Program
:                    Duplicate X
 `+--`               Push "+--"
      `|  `          Push "|  "
           "         Pair into ["+--", "|  "]
            *        Repeat each X times
             $ẋ      Repeat that X times
               f     Flatten
                Ḣ    Remove first row
                 vḢ  Remove first column from each

j                    flag: output top of stack separated by newlines

```
> 6 votes

# Answer
# Pip `-l`, ~~28~~ ~~24~~ 23 bytes

```
@>*@>:["+--""|  "]XaRLa

```

Try it online!

### Explanation

Same idea as my Python answer, implemented a bit more directly:

```
      ["+--""|  "]       List of two strings
                  Xa     Repeat each string n times
                    RLa  Repeat the whole list n times
   @>:                   All but the first item of the list (: forces @> to be
                           lower precedence than X and RL)
@>*                      All but the first item of each string in the list
                         Autoprint (implicit), one string per line (-l flag)

```
> 6 votes

# Answer
# , 34 bytes

```
'| +-'{~<:@+:$#:@6(,:+&2)@$~*&3-1:

```

Try it online!

Consider 3 as input:

* `#:@6...$~*&3-1:` Six in binary `#:@6` expands to `1 1 0` and "input times 3 minus 1" is 8 `*&3-1:`, so we extend `1 1 0` that far:

```
1 1 0 1 1 0 1 1

```
* `(,:+&2)@` Stack that with 2 added to itself:

```
1 1 0 1 1 0 1 1
3 3 2 3 3 2 3 3

```
* `<:@+:$` Now extend that to length "2 times input minus 1":

```
1 1 0 1 1 0 1 1
3 3 2 3 3 2 3 3
1 1 0 1 1 0 1 1
3 3 2 3 3 2 3 3
1 1 0 1 1 0 1 1

```
* `'| +-'{~` And use that to index into the grid characters:

```
  |  |
--+--+--
  |  |
--+--+--
  |  |

```
> 6 votes

# Answer
# C (clang), 71 bytes

```
l;f(n){for(l=n*3,n=n*2*l-l;--n;)putchar(n%l?"|  +--"[n/l%2*3+n%3]:10);}

```

Try it online!

```
l=n*3        line length (\n included)
n=n*2*l-l    total characters count
for(..;--n)  while we iterate backwards :
n%l?..:10    > put a return at end of line or..
"|  +--"[n/l%2*3+n%3] > take the proper char to put

```
> 5 votes

# Answer
# Python 2 or 3, ~~49~~ ~~46~~ 42 bytes

*-4 bytes thanks to dingledooper*

```
lambda n:([("+--"*n)[1:],"  |"*~-n]*n)[1:]

```

Returns a list of lines. Try it online!

### Explanation

It's easy to generate this grid:

```
+--+--+--
|  |  |
+--+--+--
|  |  |
+--+--+--
|  |  |

```

Then we can trim off the first line as well as the first character of each line.

Since the latest golf, the code works a *little* differently:

```
([("+--"*n)[1:],"  |"*~-n]*n)[1:]
   "+--"*n                         # Repeat the horizontal line pattern n times
  (       )[1:]                    # and remove the first character
                "  |"*~-n          # Repeat the other pattern n-1 times
                                   # (trailing spaces aren't required, so
                                   # we don't have to remove anything)
 [             ,         ]         # Put those two strings in a list
                          *n       # Repeat the list n times
(                           )[1:]  # and remove the first element

```
> 5 votes

# Answer
# 6502 machine code, Apple 2, 61 bytes

I got a bit carried away...

$130 - $F3 = $3D (61 decimal) bytes

Listing:

```
0000F3r 1               n := $f0
0000F3r 1               c := $f1
0000F3r 1               ; X register contains n
0000F3r 1  86 F0        grid:   stx n
0000F5r 1  CA                   dex
0000F6r 1  86 F1                stx c
0000F8r 1  A6 F1        @loop: ldx c
0000FAr 1  A9 rr        @cloop: lda #<coldiv
0000FCr 1  A0 rr                ldy #>coldiv
0000FEr 1  20 rr rr             jsr msgoutay
000101r 1  CA                   dex
000102r 1  D0 F6                bne @cloop
000104r 1  20 8E FD             jsr CROUT
000107r 1  C6 F0                dec n
000109r 1  F0 19                beq @done
00010Br 1  A6 F1                ldx c
00010Dr 1  A9 rr        @rloop: lda #<rowdiv
00010Fr 1  A0 rr                ldy #>rowdiv
000111r 1  20 rr rr             jsr msgoutay
000114r 1  CA                   dex
000115r 1  D0 F6                bne @rloop
000117r 1  A9 rr                lda #<rowend
000119r 1  A0 rr                ldy #>rowend
00011Br 1  20 rr rr             jsr msgoutay
00011Er 1  20 8E FD             jsr CROUT
000121r 1  4C rr rr             jmp @loop
000124r 1  60           @done:  rts
000125r 1
000125r 1
000125r 1  A0 A0 FC 00  coldiv:    ASZ "  |"
000129r 1  AD AD AB 00  rowdiv:   ASZ "--+"
00012Dr 1  AD AD 00     rowend:  ASZ "--"
000130r 1

```

Example run called with

```
    ldx #4
    jsr grid

```
> 5 votes

# Answer
# Pari/GP, 71 bytes

```
n->[print(concat([["  ","--";"|","+"][j+1,t+1]|j<-r]))|t<-r=[2..2*n]%2]

```

Try it online!

Thanks to alephalpha for saving 39 bytes.
> 5 votes

# Answer
# Ruby, 46 bytes

```
->n{(2..n*2).map{|x|[" -"[x%=2]*2]*n*"|+"[x]}}

```

Try it online!
> 4 votes

# Answer
# APL(Dyalog Unicode), ~~46~~29 bytes SBCS

```
{⍉1↓⍉⊃,/⍵⍴⊂(⍵+⍵-1)3⍴'|  +--'}

```

Try it on APLgolf!

* saved 17 thanks to @Razetime tips!

(⍵+⍵-1)3⍴'| +--' we build the entire column e.g.

```
|
+--
|
+--
|

```

Then :

```
⍵⍴⊂    ⍝  n copies of that column
,/     ⍝  concatenate
⊃      ⍝  disclose
⍉1↓⍉   ⍝ transpose, drop line, re transpose

```
> 4 votes

# Answer
# brainfuck, 841 bytes

```
->>>>>+++++[>+++++>+++++<<-],[+>-[<-->-]>[>>>>+>+<<<<<-]>>>,]+++[<+++>-]+[-<<<<<[->+>+>+<<<]>>>[<<<+>>>-]<<<+]->>>>>->->->>>[<+++++++++[>+>+>+<<<-]>>>>>>]->--[<<+>>-]>[<<+++++>>-]<<[[->>>>>+<<<<<]<]<+[--[>>>>>>>..>.<<<<<<<<-]+<<<<<[[<<<+>>>-]<<<[->>>+>+>+<<<<<]>>>>+>-<[>[[-]<[-]<->>>>>[+++++++++>>>>>]<<<<<+>>>>]<[--<<<<<]]>[++>>>--<<[>>>>>]>]<<]<<+]++++++++++.[-]-<+[--[->>++[-<<<+[->>[-]<<[<+>-]<[>+>>+<<<-]<<<<+]-[>>>>>]<<<+[--[>[>+>-<<-]>[<+>-]>+[->->>>..>.<<<<<]>+[->>>+++++++++++++..--.-----------<<<]<<<<-]+<<<<<[[<<<+>>>-]<<<[->>>+>+>+<<<<<]>>>>+>-<[>[[-]<[-]<->>>>>[+++++++++>>>>>]<<<<<+>>>>]<[--<<<<<]]>[++>>>--<<[>>>>>]>]<<]<<+]>[>+>+<<-]>[<+>-]>[->>>>+++++++++++++..-------------<<<<]<++++++++++.[-]<]<<]+<<<<<[[<<+>>-]<<[->>+>>+>+<<<<<]>>>>+>-<[>[[-]<[-]<<->>>>>[+++++++++>>>>>]<<<<<+>>>>>]<[--<<<<<]]>[++>>--<[>>>>>]>]<<<]<<+]

```

edit1, thank you for the suggestion by Radvylf Programs

this work by using 5 cells per digit, 1 for original number, 1 for row number, 1 for column number, and 2 for verifying that help to make the number system work.

Try it online!

also, I edited the first one(adding "+" version) to get a better result. here

# brainfuck(adding "+" version) ,~~273~~ 198 bytes

```
-[>+>+>+<<<-]>>> >>> >>> >+++++[<+++<+++++<<++++++<++>>>>>-]<<[<+++++>-]>[<+++>-]<<-<++<<<[->>>..>.<<<<]>>.<<<<[->[->+>+<<]>[<+>-]>[>>>>..--.++<<<<-]>>>>..<<<.<<<[->+>+<<]>[<+>-]>[>>..>.<<<-]>.<<<<]

```

Try it online!
> 4 votes

# Answer
# Retina 0.8.2, 43 bytes

```
.+
$*
1
$_¶$_¶
1
+--
T`-+` |`¶.+¶
1A`
%`^.

```

Try it online! Explanation:

```
.+
$*

```

Convert to unary.

```
1
$_¶$_¶

```

Create `2n` rows of `n` `1`s.

```
1
+--

```

Replace each `1` with `+--`.

```
T`-+` |`¶.+¶

```

Change those to  `|` on alternate lines.

```
1A`

```

Delete the first line of `--+`s.

```
%`^.

```

Delete the leading `+`s or `|`s on each line.
> 3 votes

# Answer
# JavaScript (Node.js), 93 bytes

```
n=>('  |'[r='repeat'](--n)+'  0')[r](n+1).slice(0,-1).split(0).join('\n'+'--+'[r](n)+'--\n');

```

Try it online!
> 3 votes

# Answer
# Stax, 14 bytes

```
╬^û╗i§║╜P◙ƒ═½\

```

Run and debug it

Similar to the Jelly answer.
> 3 votes

# Answer
# \[PowerShell\], 53 bytes

```
&{$c=$n-1;@("  |"*$c)*$n -join "`n$(""--+""*$c)--`n"}

```

Try it online!
> 2 votes

---
Tags: code-golf, ascii-art, printable-ascii
---


title: Appease the Picky Eater

text:
# Question
Title: Appease the Picky Eater
Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he strives to meet with his diet. To complicate things further, Jack's cravings change day by day, and he will only eat the foods that he wants, up to a certain amount. Your goal is to write a program that Jack can use to enter his goals and his cravings on a given day, and be shown a combination of those foods that most closely matches his dietary requirements.

**Program Input** \- Accept the following data in any convenient format for your programming language. All integers, except for food names which are strings. Carbs, fats, and protein are given in grams.

* Jack's Dietary Requirements:

+ A Calorie Target
    + A Carbohydrate Target
    + A Fat Target
    + A Protein Target
* A list of foods (of any length), containing the following info:

+ The name of the food
    + Calories per serving
    + Carbohydrates per serving
    + Fat per serving
    + The maximum number of servings that Jack is willing to consume in a day

**Program Output** \- Text, or any data structure that can assocaite the name of a food with the optimal number of servings

* A list of the number of servings (integers) of each food that Jack should have to get closest to his diet requirements. (It is ok for the number of calories, protein, fat, or carbs to be above or below the requirements. Only return the closest solution).

The **absolute difference score** of a combination of foods will be scored as follows (lower scores are better):

* 1 point for each calorie difference from Jack's goal. Ex, if the total number of calories for a given number of servings for each food adds up to 1800, and Jack's goal is 2000 calories, add 200 points to the score.
* 10 points for each gram difference from Jack's goal. Ex, if a combination of foods and servings contains a total of 160 grams of protein, and Jack's goal is 150, add 100 points to the score.

Your program should return **the** solution with the lowest absolute difference score - a number of servings for each of Jack's craved foods. If multiple combinations have the same score, return any of them.

**Example**

```
Input:

{
    'goals':[
        'calories': 2000,
        'carbs': 200,
        'fats': 120,
        'protein': 150
    ]
    'cravings':[
        'chocolate':[
            'calories': 130,
            'carbs': 14,
            'fats': 8,
            'protein': 10,
            'max_servings': 99
        ]
        'beans': [
            'calories': 80,
            'carbs': 6,
            'fats': 2,
            'protein': 18,
            'max_servings': 99
        ]
    ]
}

Output:

chocolate 15
beans 0

```

This is , so the shortest code wins.

# Answer
> 1 votes
# 05AB1E, ~~34~~ ~~33~~ ~~30~~ ~~25~~ ~~23~~ 20 bytes

```
sÝ.«â€˜Σ³*øOα`T/O}нø

```

-1 byte inspired by *@DominicVanEssen*'s R answer, calculating the scores as 10% of the calories and 100% of the grams instead of 100% calories and 1000% of the grams, and an additional -1 byte could now be achieved by changing the input-order of `[calories, carbs, fats, protein]` to `[carbs, fats, protein, calories]`
-3 bytes thanks to *@JonathanAllan*

Takes four separated inputs:
1. A string-list of `names` (e.g. `["chocolate","beans"]`);
2. An integer-list of `max_servings` (e.g. `[99,99]`);
3. A list of integer-lists of `[carbs, fats, protein, calories]` (e.g. `[[14,8,10,130],[6,2,18,80]]`);
4. And a list of integers for the intended goal, also `[carbs, fats, protein,calories]` (e.g. `[200,120,150,2000]`).
Output as a list of `[name, amount]` pairs.

Try it online.

**Explanation:**

Step 1: Generate amount-lists for each possible diet based on the first input-list:

```
s          # Swap to push both the first (implicit) input-list of names as well as
           # second (implicit) input-list of max_servings to the stack
 Ý         # Map each inner integer to a list in the range [0,max_servings]
  .«       # Right-reduce this list by:
    â      #  Taking the cartesian product
     €˜    # After that, flatten each inner nested list
           # (we now have a list of all possible diet-combinations)

```

Try just step 1 online.

Step 2: Calculate the (modified) score of each possible diet-combination based on the second input, and sort the diet-combinations based on that:

```
Σ          # Sort the list of diet-combinations by:
 ³*        #  Multiply each individual integer by values in the third input-list of
           #  [carbs,fats,protein,calories]-quartets
   ø       #  Zip/transpose; swapping rows/columns
    O      #  Sum the other inner lists
     α     #  Get the absolute difference with the fourth (implicit) input-list with the
           #  diet-goal
      `    #  Pop and push all four values to the stack
       T/  #  Divide the top calories by 10
         O #  Take the sum of the four values on the stack
 }         # Close the sort-by
           # (we've now sorted all possible diet-combinations by their scores)

```

Try steps 1 and 2 online.

Step 3: Get the diet-combination with the lowest score, pair it with the names of the first input, and output it as result:

```
н          # Pop and push the first diet-combination of the sorted list
 ø         # Create pairs with the list of names that's still on the stack
           # (after which the result is output implicitly)

```

# Answer
> 1 votes
# , ~~100~~ ~~87~~ 85 bytes

```
function(m,n,g,p=t(expand.grid(Map(seq,m+1))-1))p[,order((.1^!0:3)%*%(n%*%p-g)^2)[1]]

```

Try it online!

Input is `m`=serving maxima (optionally named to indicate the names of the foods); `n`=nutrition information, as a matrix with food types as columns (in the same order as `m`), and nutrient types content as rows; and `g`=Jack's goals (in the same order as the rows of `m`).

Output is the optimal number of servings, in the same order as `m` and with the names if supplied.

**Ungolfed:**

```
servings=function(m,n,g){
    p=t(expand.grid(Map(seq,m+1))-1)
                                # Calculate all possible portions as matrix p
                                # (rows are foods, columns are different servings);
    o=n%*%p                     # Calculate o=obtained nutrients
                                # by multiplying matrix n (nutrients) by matrix p;
    s=c(.1,1,1,1)%*%abs(o-g)    # Calculate s=scores
                                # by multiplying absolute differences between o and g
                                # by the 1x4 matrix of scoring weights (.1,1,1,1);
    result=p[,which.min(s)]     # The result is the column of p with the minumum score
    return(result)
}

```

# Answer
> 0 votes
# Charcoal, ~~75~~ 73 bytes

```
⊞υＥ⁵∧¬ι⟦⟧Ｆη«≔υζ≔⟦⟧υＦ⊕⊟ιＦζ⊞υＥλ⎇ν⁺μ×κ§ιν⁺μ⟦§ι⁰κ⟧»⪫⊟⌊Ｅυ⟦ΣＥθ×↔⁻λ§ι⊕μ∨¬μχ§ι⁰⟧

```

Try it online! Link is to verbose version of code. Takes as first input a list of targets and as second input a list of foods each being a list of names, nutritional values and maximum servings and outputs a space separated string of foods and servings e.g. `chocolate 15 beans 0`. Explanation:

```
⊞υＥ⁵∧¬ι⟦⟧Ｆη«≔υζ≔⟦⟧υＦ⊕⊟ιＦζ⊞υＥλ⎇ν⁺μ×κ§ιν⁺μ⟦§ι⁰κ⟧»

```

Form the Cartesian product of the ranges of all possible servings of all input foods, including their names, plus also calculating the nutrition each combination of servings provides.

```
⪫⊟⌊Ｅυ⟦ΣＥθ×↔⁻λ§ι⊕μ∨¬μχ§ι⁰⟧

```

Calculate the score for each combination of servings and output the combination of servings with the lowest score.

65 bytes using the newer version of Charcoal on ATO:

```
⊞υＥ⁵∧¬ι⟦⟧Ｆη≔ΣＥ⊕⊟ιＥυＥμ⎇π⁺ξ×κ§ιπ⁺ξ⟦§ι⁰κ⟧υ⪫⊟⌊Ｅυ⟦ΣＥθ×↔⁻λ§ι⊕μ∨¬μχ§ι⁰⟧

```

Attempt This Online! Link is to verbose version of code.

---
Tags: code-golf, matrix, linear-algebra
---