Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

...will you help me immortalize it?

enter image description here

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.

Since I'll bring this with me, I'd prefer if you make it as short as possible. 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>

share|improve this question
7  
I'm somewhat disappointed that the pattern isn't a little more complex, to represent the different line thicknesses of the pillow. – Sparr Nov 6 at 11:29
4  
@Sparr I tried, but I didn't manage to make it look good using only ASCII characters. Figured this was close enough :) – Stewie Griffin Nov 6 at 11:37
2  
I'd have just added spaces – Sparr Nov 6 at 20:37
10  
My eyes........ – Alex L. Nov 7 at 0:02
3  
Now you can buy a blank pillow and print the winner snippet on it. – coredump Nov 7 at 19:46

57 Answers 57

up vote 18 down vote accepted

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!

share|improve this answer
1  
Wow... two different takes, same byte count... – Oliver Nov 6 at 14:00

///, 116 bytes

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

Try it online!

Well, the bonus belongs to me!

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.

share|improve this answer
8  
+1 for using /// – leo Nov 7 at 9:59

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
share|improve this answer
    
1 byte improvement a,b='\/' exec("a,b=b,a;"+"print(a*5+b*5)*6;"*4)*6 – Mitch Schwartz Nov 6 at 11:11

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.

share|improve this 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.

share|improve this answer
    
Oh my goodness this language is awesome! – Hamsteriffic Nov 7 at 15:11

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());

share|improve this answer
    
I think you can leave out the first &1 and save two bytes – Henrik Christensen Nov 7 at 13:01
    
@HenrikChristensen That would only work for n < 480. For n >= 480, we'd need parentheses: (n/240^n/5)&1. – Arnauld Nov 7 at 13:14
    
Thanks, you're right, was too fast on the trigger there – Henrik Christensen Nov 7 at 13:32

Haskell, 77 70 57 bytes

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

Boring concats and replicates 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]]
share|improve this answer

Dyalog APL, 24 bytes

(60⍴5/0 4)⊖60/⍪∊3⍴⊂4/'/\'
share|improve this answer
    
'/\'[4⌿5/2|+/¨⍳6 12] (requires ⎕io←0) – ngn Nov 11 at 18:31
    
@ngn Why don't you just post it? – Adám Nov 12 at 18:33
    
done – ngn Nov 12 at 18:51

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!

share|improve this 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

share|improve this answer
4  
I believe that *6*4 is the same as *24? :p – Adnan Nov 6 at 9:38

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 ;)

share|improve this answer
2  
Welcome to PPCG! Nice first answer :) Can you skip some of the intermediate variables? At least d and e, maybe more. I haven't tested this, but it should be close: print(4*c+4*(6*b+"\n"))*3. It's 5 bytes less. – Stewie Griffin Nov 7 at 13:40
3  
55 bytes: a="/"*5+"\\"*5;print(4*(6*a+"\n")+4*(6*a[::-1]+"\n"))*3 – Stewie Griffin Nov 7 at 13:44

Jelly, 17 16 bytes

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

Try it online!

Thanks to 6710 (miles) for -1 byte.

share|improve this answer
1  
I think you can save a byte with ⁾/\ẋ6Wẋ4;U$ẋ3x5Y – miles Nov 6 at 9:41
    
@miles Thanks, it seems I can't effectively use quicks yet :) And I knew I didn't need two Ys! – Erik the Golfer Nov 6 at 9:45

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
share|improve this answer
    
Can you do something like "/\"5*S for creating the string of slashes? – Adnan Nov 6 at 9:44
    
@Adnan Great idea! – Mego Nov 6 at 9:45

Ruby, 46 bytes

Creates the following string (70 characters, one set more than needed) then alternates between sampling characters 0..59 and 5..64from 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]}

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\
share|improve this 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)
share|improve this 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
share|improve this 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.

share|improve this 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

share|improve this answer
    
Welcome to the site! – DrMcMoylex Nov 7 at 19:02
    
Does not work for me. Browser hang up with this interpreter, and personnal one show a non expected 5 line output: /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ four times, then infinite \ . – aluriak Nov 8 at 23:34

V, 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
share|improve this answer
    
It's cool to see someone else using V! Up until recently, it's only been me. If you ever need help with it, feel free to ping me in the nineteenth byte – DrMcMoylex Nov 9 at 15:39
    
@DrMcMoylex Yup your language seems fun to use :-) I had a problem on this one: initially I wanted to use 5á\5á/05ä$5Ä5x$p4Ä3äG i.e. replace Y4P by but for a reason that I don't understand it copies an additional blank line... If you can enlighten me on this one it would be nice. Also if I find some free time i'd gladly contribute to the language (especially issue #4) – statox Nov 9 at 15:45
    
Ah, yes that has troubled me many times. It's a known issue. The problem is that Ä is a synonym for dd, not Y. This is usually not an issue, but it causes some problems if the buffer has only one line or if you're on the last line. – DrMcMoylex Nov 9 at 15:48
    
Actually, I just realized, that approach would still work if you replaced 3äG with 3ä} since it won't yank that last newline. v.tryitonline.net/… – DrMcMoylex Nov 9 at 15:49
    
Ok I think I get why it didn't work now. And nice way to win 1 byte, thanks! – statox Nov 9 at 15:56

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))
share|improve this answer
1  
This uses the same method as my Jelly answer. – Erik the Golfer Nov 6 at 9:13
    
More efficient method than mine to start with – ElPedro Nov 6 at 9:23
    
@ElPedro Basically, I just did some string/array manipulation. The trick is that I have prepared a bigger string: /////\\\\\/////... four times, separated by newlines – Erik the Golfer Nov 6 at 9:26

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.

share|improve this answer

J, 31 28 19 bytes

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

Usage

   4#_60]`|.\5#72$'/\'
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
share|improve this 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
share|improve this answer
    
no need for an anonymous function; save 3 bytes. – Tasos Papastylianou Nov 9 at 10:48
    
@TasosPapastylianou there is, otherwise it will print ans= before the pillow. Having it in the function gets around this as it is expected to return the answer to a variable rather than displaying it. – Tom Carpenter Nov 9 at 11:04
    
That's just semantics. I mean, if you're going to be pedantic I'd worry more about the 3-line warning messages that appear instead :p Also the usual rules state that it needs to be either an output from a direct terminal command, or a callable function handle. Meaning you should assign your anonymous function to a handle (or add another 5 bytes to account for having to pring ans()). Which is pointless, since ans() still prints ans when run! – Tasos Papastylianou Nov 9 at 11:42
    
@TasosPapastylianou ans() is a callable function handle, so you don't need to assign it to something with, e.g. a=@..., because it is implicitly assigned to ans as a handle. Also it doesn't print ans= when run unless you specifically ask it to by not doing anything with the returned value and not adding a ;. If you did disp(ans()) it would only print the exact output (no ans=). But yes, the warning is annoying, however that didn't happen previously, so it isn't language specific, but rather interpreter specific. – Tom Carpenter Nov 9 at 13:27
    
Ok, we'll agree to disagree. The way I see it, if you're relying on disp(ans()) before getting your output, then you need to add 12 bytes to your answer. My own opinion is that this is just the way octave presents its result and that's fine. – Tasos Papastylianou Nov 9 at 16:14

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

share|improve this answer
1  
69 bytes: for($s='/\\';$i<1440;$i++)echo$i%60<1?'\n':'',$s[($i/5+($i/2‌​40|0))%2]; (replace the \n with a real newline). echo isn't a function, so, it doesn't need parenthesys. Also, echo can receive multiple values, separated by a comma. This really removes the need for those parenthesys. And then, inside your $s[...], the outer-most calculation doesn't need parenthesys either, since it is contained withing []. Using $s[($i/5+($i/240|0))%2] has the same effect and is shorter. – Ismael Miguel Nov 6 at 18:39
    
Thank you, updated! I didn't even know about echo accepting multiple parameters ^_^ – chocochaos Nov 6 at 21:24
    
echo and print accept multiple parameters. But print requires parenthesys with multiple parameters when used on a loop's increment, condition or assignment. – Ismael Miguel Nov 7 at 0:08
    
Can shave off that <1, by switching the expressions, echo$i%60?'':' ',, new line as expression 3 in the ternary. – Progrock Nov 9 at 15:56

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();}
share|improve this answer
    
61 bytes: i;f(){for(i=1463;i;)putchar(i--%61?i%61/5+i/244&1?92:47:10);‌​}. – orlp Nov 6 at 16:26
    
@orlp thanks, I knew there had to be a better way with the i-- but I didn´t have time to look for it. – Level River St Nov 6 at 21:58

Brainfuck, 140 bytes

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

:-D

share|improve this answer
1  
Oh, look! The brainfuck solution is eight bytes shorter than the Java solution. Time for Java coders to switch to brainfuck... – J843136028 Nov 7 at 19:26
    
Java strikes back – cliffroot Nov 7 at 21:19
    
@cliffroot u wot m8 – J843136028 Nov 8 at 16:51

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.

share|improve this answer

SOML, 20 bytes (non-competing)

 /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

oops, forgot that I added the "t" function later today so non-competing

share|improve this 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
share|improve this answer

Vitsy, 28 26 bytes

This can be golfed a bit.

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

Try it online!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.