This is my pillow

68

5

...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.

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>

Stewie Griffin

Posted 2016-11-06T08:27:50.567

Reputation: 43 471

7I'm somewhat disappointed that the pattern isn't a little more complex, to represent the different line thicknesses of the pillow. – Sparr – 2016-11-06T11:29:06.620

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 – 2016-11-06T11:37:03.717

3I'd have just added spaces – Sparr – 2016-11-06T20:37:43.090

1'apparently' :P – Pysis – 2016-11-07T19:01:55.340

7Now you can buy a blank pillow and print the winner snippet on it. – coredump – 2016-11-07T19:46:24.120

1@coredump Nah, I wouldn't like to have an 05AB1E pillow, better do its output... except if it was 05AB1E for "Good night, good sleep." – Erik the Outgolfer – 2016-11-08T15:28:11.323

Related: Make me a blanket!

– sergiol – 2018-04-10T14:17:57.447

Answers

24

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!

Adnan

Posted 2016-11-06T08:27:50.567

Reputation: 41 965

2Wow... two different takes, same byte count... – Oliver Ni – 2016-11-06T14:00:42.077

30

///, 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.

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

15

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

xnor

Posted 2016-11-06T08:27:50.567

Reputation: 115 687

12

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.

Oliver Ni

Posted 2016-11-06T08:27:50.567

Reputation: 9 650

8

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

Arnauld

Posted 2016-11-06T08:27:50.567

Reputation: 111 334

I think you can leave out the first &1 and save two bytes – Henrik Christensen – 2016-11-07T13:01:03.647

@HenrikChristensen That would only work for n < 480. For n >= 480, we'd need parentheses: (n/240^n/5)&1. – Arnauld – 2016-11-07T13:14:50.827

8

Bubblegum, 30 bytes

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

Obligatory Bubblegum answer.

LegionMammal978

Posted 2016-11-06T08:27:50.567

Reputation: 15 731

Oh my goodness this language is awesome! – Pedro A – 2016-11-07T15:11:16.820

7

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]]

Angs

Posted 2016-11-06T08:27:50.567

Reputation: 4 825

6

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

ElPedro

Posted 2016-11-06T08:27:50.567

Reputation: 5 301

4I believe that *6*4 is the same as *24? :p – Adnan – 2016-11-06T09:38:46.737

6

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.

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

6

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

Ivar Matstoms

Posted 2016-11-06T08:27:50.567

Reputation: 61

2Welcome 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 – 2016-11-07T13:40:06.837

355 bytes: a="/"*5+"\\"*5;print(4*(6*a+"\n")+4*(6*a[::-1]+"\n"))*3 – Stewie Griffin – 2016-11-07T13:44:28.350

6

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

Axel Matstoms

Posted 2016-11-06T08:27:50.567

Reputation: 61

Welcome to the site! – James – 2016-11-07T19:02:37.957

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 – 2016-11-08T23:34:33.580

Yes, it works :) – aluriak – 2017-02-26T22:47:14.620

6

Brainfuck, 140 bytes

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

:-D

0WJYxW9FMN

Posted 2016-11-06T08:27:50.567

Reputation: 2 663

3Oh, look! The brainfuck solution is eight bytes shorter than the Java solution. Time for Java coders to switch to brainfuck... – 0WJYxW9FMN – 2016-11-07T19:26:28.227

Java strikes back – cliffroot – 2016-11-07T21:19:51.177

5

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!

Blue

Posted 2016-11-06T08:27:50.567

Reputation: 26 661

5

Dyalog APL, 24 bytes

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

Adám

Posted 2016-11-06T08:27:50.567

Reputation: 37 779

'/\'[4⌿5/2|+/¨⍳6 12] (requires ⎕io←0) – ngn – 2016-11-11T18:31:18.840

@ngn Why don't you just post it? – Adám – 2016-11-12T18:33:09.810

1done – ngn – 2016-11-12T18:51:28.863

5

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

Luis Mendo

Posted 2016-11-06T08:27:50.567

Reputation: 87 464

5

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.

RK.

Posted 2016-11-06T08:27:50.567

Reputation: 497

5

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

statox

Posted 2016-11-06T08:27:50.567

Reputation: 181

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

– James – 2016-11-09T15:39:19.953

@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 – 2016-11-09T15:45:13.910

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. – James – 2016-11-09T15:48:45.310

Actually, I just realized, that approach would still work if you replaced 3äG with 3ä} since it won't yank that last newline. http://v.tryitonline.net/#code=NcOhXDXDoS8wNcOkJDXDhDV4JHA0w4Qzw6R9&input=

– James – 2016-11-09T15:49:35.970

Ok I think I get why it didn't work now. And nice way to win 1 byte, thanks! – statox – 2016-11-09T15:56:38.260

4

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

Mego

Posted 2016-11-06T08:27:50.567

Reputation: 32 998

Can you do something like "/\"5*S for creating the string of slashes? – Adnan – 2016-11-06T09:44:12.323

@Adnan Great idea! – Mego – 2016-11-06T09:45:12.037

4

Jelly, 17 16 bytes

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

Try it online!

Thanks to 6710 (miles) for -1 byte.

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

1I think you can save a byte with ⁾/\ẋ6Wẋ4;U$ẋ3x5Y – miles – 2016-11-06T09:41:51.227

@miles Thanks, it seems I can't effectively use quicks yet :) And I knew I didn't need two Ys! – Erik the Outgolfer – 2016-11-06T09:45:13.987

4

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]}

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

Level River St

Posted 2016-11-06T08:27:50.567

Reputation: 22 049

4

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

Level River St

Posted 2016-11-06T08:27:50.567

Reputation: 22 049

61 bytes: i;f(){for(i=1463;i;)putchar(i--%61?i%61/5+i/244&1?92:47:10);}. – orlp – 2016-11-06T16:26:17.177

@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 – 2016-11-06T21:58:00.020

4

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)

ren

Posted 2016-11-06T08:27:50.567

Reputation: 189

3

Canvas, 10 9 bytes

/54*╬6×3*

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

dzaima

Posted 2016-11-06T08:27:50.567

Reputation: 19 048

3

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

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

1

This uses the same method as my Jelly answer.

– Erik the Outgolfer – 2016-11-06T09:13:38.023

More efficient method than mine to start with – ElPedro – 2016-11-06T09:23:31.057

@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 Outgolfer – 2016-11-06T09:26:03.117

3

J, 31 28 19 bytes

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

Usage

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

miles

Posted 2016-11-06T08:27:50.567

Reputation: 15 654

3

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

Tom Carpenter

Posted 2016-11-06T08:27:50.567

Reputation: 3 990

no need for an anonymous function; save 3 bytes. – Tasos Papastylianou – 2016-11-09T10:48:13.343

@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 – 2016-11-09T11:04:51.397

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 – 2016-11-09T11:42:17.583

@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 – 2016-11-09T13:27:29.033

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 – 2016-11-09T16:14:23.693

3

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.

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

3

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

chocochaos

Posted 2016-11-06T08:27:50.567

Reputation: 547

169 bytes: for($s='/\\';$i<1440;$i++)echo$i%60<1?'\n':'',$s[($i/5+($i/240|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 – 2016-11-06T18:39:09.237

Thank you, updated! I didn't even know about echo accepting multiple parameters ^_^ – chocochaos – 2016-11-06T21:24:38.053

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 – 2016-11-07T00:08:49.937

Can shave off that <1, by switching the expressions, echo$i%60?'':' ',, new line as expression 3 in the ternary. – Progrock – 2016-11-09T15:56:50.720

3

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

statox

Posted 2016-11-06T08:27:50.567

Reputation: 181

Oh hey statox, welcome to the site! This totally fits the rules. I golf mostly in vim. Just so you know, you could do 5i/<esc>5a\<esc>0y$5P at the start to save 9 bytes. – James – 2016-11-07T20:16:07.990

Hey DrMcMoylex (new name? :-) ) glad to see you here and that my answer fits. Also thanks for your hint, I'll edit my answer – statox – 2016-11-07T22:27:26.857

2

Haha, yeah I temporarily changed my name because of this challenge, lol. I'll change it back in 30 days

– James – 2016-11-07T22:36:18.317

3

Brainfuck, 168 bytes

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

Mitchell Humphrey

Posted 2016-11-06T08:27:50.567

Reputation: 348

3

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

cliffroot

Posted 2016-11-06T08:27:50.567

Reputation: 1 080

3

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
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

Mario

Posted 2016-11-06T08:27:50.567

Reputation: 3 043

2

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

dzaima

Posted 2016-11-06T08:27:50.567

Reputation: 19 048

2

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

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

2

Vitsy, 28 26 bytes

This can be golfed a bit.

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

Try it online!

Addison Crump

Posted 2016-11-06T08:27:50.567

Reputation: 10 763

2

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.

Denis Ibaev

Posted 2016-11-06T08:27:50.567

Reputation: 876

2Didn't think to use an array to store the slashes, nice! You can save 1 byte dropping the outermost () and prepend +: perl -E 'say+((@_=('/'x5,'\\'x5)x6,$/)x4,(pop@_,@_,$/)x4)x3' – Dom Hastings – 2016-11-07T12:45:10.077

2

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

Erik the Outgolfer

Posted 2016-11-06T08:27:50.567

Reputation: 38 134

That explanation was painful to write... wish there was some way to use <something>5"/\\" instead of +*5\/*5\\. – Erik the Outgolfer – 2016-11-06T18:09:12.737

sC*5]"/\\" There is, but it's a byte longer. – Steven H. – 2016-11-06T18:21:30.057

I see I still have a fair bit to learn. I've only posted 2 Pyth answers but I hope I'm getting there. Any suggestions/comments as to how I could improve how I did it? Gratefully received if so :) – ElPedro – 2016-11-06T18:51:59.773

2

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

PieCot

Posted 2016-11-06T08:27:50.567

Reputation: 1 039

2

ngn

Posted 2016-11-06T08:27:50.567

Reputation: 11 449

1

R, 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!

Giuseppe

Posted 2016-11-06T08:27:50.567

Reputation: 21 077

1

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.

BradC

Posted 2016-11-06T08:27:50.567

Reputation: 6 099

1

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

dzaima

Posted 2016-11-06T08:27:50.567

Reputation: 19 048

1

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!

Quantum64

Posted 2016-11-06T08:27:50.567

Reputation: 371

1

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

ElPedro

Posted 2016-11-06T08:27:50.567

Reputation: 5 301

1I've never tried pyth apart from looking at the docs once or twice, but I think you can replace FN24 with V24 – FlipTack – 2016-11-06T12:37:21.923

Nice. Just tested and it works. Will check the docs on that. – ElPedro – 2016-11-06T12:39:55.690

1

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
        }

WerWet

Posted 2016-11-06T08:27:50.567

Reputation: 11

Can save at least two bytes with b%5>0 and c=a%3>1... I'm not sure because I'm on my phone but you may be able to store c as a char instead of a string and save a few bytes using implicit int to char conversions. Also do you really need all the c= in the last line ? I think it can be c=a%3>1?c=="/"?"\\":"/“:c; I see why you do it in the inner loop due to assigning to c and appending to s at the same time but you can probably refactor that a bit for byte savings as well – pinkfloydx33 – 2016-11-06T19:48:33.760

Maybe also take the post increments out of the loop and add them into into the assignments... Ie s+=b++%5... and c=a++%3... save another two bytes – pinkfloydx33 – 2016-11-06T19:52:14.417

Thank you, I complete forgot these c= in last line. Implicit int to char conversions does not work, because char is 16bit and written number is 32bit int, so there is only cast avaiable. – WerWet – 2016-11-06T20:52:48.197

1

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

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

Timtech

Posted 2016-11-06T08:27:50.567

Reputation: 12 038

Are there missing newlines? – for Monica – 2016-11-06T14:42:08.553

1

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

Mukul Kumar

Posted 2016-11-06T08:27:50.567

Reputation: 2 585

1Why braces on the second for loop? – pinkfloydx33 – 2016-11-06T20:56:20.190

edited @pinkfloydx33 – Mukul Kumar – 2016-11-09T22:38:21.850

1

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.

Andrakis

Posted 2016-11-06T08:27:50.567

Reputation: 361

1

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)

AdmBorkBork

Posted 2016-11-06T08:27:50.567

Reputation: 41 581

1

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

Brian Gradin

Posted 2016-11-06T08:27:50.567

Reputation: 569

1

Ruby, 83 + 14 = 97 bytes

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

Add 14 bytes for -rzlib and -rbase64 flags.

dkudriavtsev

Posted 2016-11-06T08:27:50.567

Reputation: 5 781

1

Julia, 56 bytes

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

Tasos Papastylianou

Posted 2016-11-06T08:27:50.567

Reputation: 233

0

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

sergiol

Posted 2016-11-06T08:27:50.567

Reputation: 3 055

0

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]

hakr14

Posted 2016-11-06T08:27:50.567

Reputation: 1 295

0

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

Output

Sophia Lechner

Posted 2016-11-06T08:27:50.567

Reputation: 1 200

Saved 8 bytes by realizing I don't need .Formula in the VBA – Sophia Lechner – 2018-03-30T23:30:49.730

0

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.

Neil

Posted 2016-11-06T08:27:50.567

Reputation: 95 035

0

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

Otávio

Posted 2016-11-06T08:27:50.567

Reputation: 161

0

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:

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

rnso

Posted 2016-11-06T08:27:50.567

Reputation: 1 635

0

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:

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

Kevin Cruijssen

Posted 2016-11-06T08:27:50.567

Reputation: 67 575

0

GolfSharp, 59 bytes

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

downrep_nation

Posted 2016-11-06T08:27:50.567

Reputation: 1 152

0

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 <?=)

Titus

Posted 2016-11-06T08:27:50.567

Reputation: 13 814

0

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

HyperNeutrino

Posted 2016-11-06T08:27:50.567

Reputation: 26 575

1

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

– Leaky Nun – 2017-06-23T16:51:21.210

TIO link please. – CalculatorFeline – 2017-06-23T17:15:30.513

@CalculatorFeline Done – HyperNeutrino – 2017-06-23T18:40:00.320

0

APL, 16

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

Try it on tryapl.org

Moris Zucca

Posted 2016-11-06T08:27:50.567

Reputation: 1 519

0

Python 3, 60 bytes

Lots of multiplying strings!

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

Output

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

Cody

Posted 2016-11-06T08:27:50.567

Reputation: 447

0

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};"rn"}; $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.

Chavez

Posted 2016-11-06T08:27:50.567

Reputation: 109

Welcome to PPCG! I get your logic, but it doesn't seem to work quite right. With the code as-is, you're going to get a bunch of Index operation failed; the array index evaluated to null. errors since $b is uninitialized on the first inner loop of 1..6. Additionally, this will join the strings you're creating with spaces, since that's the default $OutputFieldSeparator when stringifying an array (what you're doing here). – AdmBorkBork – 2016-11-08T20:06:15.793

Additionally, you don't need both r and n -- just n will work for newlines. You've also got an extra space between ; and $b=. – AdmBorkBork – 2016-11-08T20:08:45.407

Must be ISE messing with me again. The host retains variables between each run, that's what got me here. Dammit. – Chavez – 2016-11-08T21:15:53.530

You can fix the array index by putting a + in front -- like $a[+$b] -- to force a cast to int. However, that doesn't eliminate the spaces between elements. :-/ – AdmBorkBork – 2016-11-08T21:31:55.240