13
\$\begingroup\$

You might know Alan Walker from his ever popular song Faded. Now his "followers" are called Walkers and they have a logo, here is a simplified version:

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

The goal of this challenge is to print this logo.

RULES:

  1. If you return a list of strings from a function as per meta standards, please provide a footer that prints it to the screen.
  2. All characters of the above logo have to be there. No shortcuts!
  3. Shortest number of bytes wins!
\$\endgroup\$
  • \$\begingroup\$ can there be extra spaces at the end of each line (as they don't change how the output looks)? Can there be leading/appending newlines? \$\endgroup\$ – dzaima Aug 17 '17 at 16:49
  • \$\begingroup\$ @dzaima, yes you can. \$\endgroup\$ – Dat Aug 17 '17 at 16:50

17 Answers 17

13
\$\begingroup\$

Charcoal, 31 30 29 27 bytes

F²«Jι⁰↙χ↖↖⁵↙↙⁵↖↖²P↖χ↙↗χ↘↘¹²

Try it online! Link is to verbose version of code. Sadly Copy doesn't do what I want in this case, so I have to loop instead. Explanation:

F²«Jι⁰

Draw everything twice, but with the cursor starting one character to the right the second time.

   ↙χ↖↖⁵↙↙⁵↖↖²P↖χ

Draw the main W from right to left, but leave the cursor near the inverted V.

   ↙↗χ↘↘¹²

Draw the inverted V.

\$\endgroup\$
  • \$\begingroup\$ You "only" beat the naive solutions by 20 bytes :P \$\endgroup\$ – Stephen Aug 17 '17 at 18:29
  • 1
    \$\begingroup\$ @StepHen A 46% saving isn't bad given the overhead of setting a loop up in the first place... \$\endgroup\$ – Neil Aug 17 '17 at 18:45
  • \$\begingroup\$ Is mirroring just not shorter for this? \$\endgroup\$ – Stephen Aug 17 '17 at 19:02
  • 5
    \$\begingroup\$ @StepHen Fixing up the asymmetry costs too much. Best I could do was 35 bytes: F²«Jι⁰↘χ↗↗⁵M⁵↑←↙χ»‖M↥\\¶ \\F²«Jι⁰↖³. \$\endgroup\$ – Neil Aug 17 '17 at 20:02
13
\$\begingroup\$

JavaScript (ES6), 172 139 bytes

let f =

_=>`1
3s1
5o5o
7k9k
9gdg
bchc
d8l8
f48194
h08590
i899
g14d41
n0h05
1p`.replace(/.p?/g,n=>' '.repeat((n=parseInt(n,36))/2)+(c='/\\'[n&1])+c)

O.innerText = f()
<pre id=O>

How?

The logo basically consists of groups of spaces followed by either // or \\ and line feeds.

Spaces and ending patterns are encoded using base-36 values:

  • The least significant bit gives the ending pattern: 0 for //, 1 for \\.
  • All other bits give the number of spaces before the ending pattern.

Everything can be encoded this way with a single base-36 digit except the last line which consists of 30 spaces followed by \\, leading to 30*2+1 = 61 = 1p in base-36. This p should be interpreted as 12 spaces followed by \\ but this pattern doesn't appear anywhere. So, we can simply handle this special case at the cost of 2 extra bytes in the regular expression: /.p?/.


First version, 186 bytes

NB: This one was submitted prior to the logo update.

let f =

_=>[...`WALKER'S`].reduce((s,c)=>(x=s.split(c)).join(x.pop()),`E
 ELSRE
'LK'
 'LRWLR
WSKS'SK
S ESRLESR
S'KL'K
S 'RKEWR
LEAK'WA
L AKWW
SKERS'RE
L 'ALEA'
LLLS'S    '  ER  AE\\\\KSALSSA//WSE`)

O.innerText = f()
<pre id=O>

\$\endgroup\$
  • \$\begingroup\$ Nicely golfed. Took a stab at this myself before checking the answers; ended up with something similar to your 172 byte version. \$\endgroup\$ – Shaggy Aug 18 '17 at 10:55
6
\$\begingroup\$

SOGL V0.12, 38 bytes

6«╝5╚@┼╬⁷7«8ž'⁸3L╚ž92L╚╬5L«26«╝╬5:21╬5

Try it Here!

\$\endgroup\$
  • \$\begingroup\$ Now we're waiting for Charcoal :P \$\endgroup\$ – Mr. Xcoder Aug 17 '17 at 17:07
  • \$\begingroup\$ @Mr.Xcoder if it doesn't beat me, I don't know. \$\endgroup\$ – dzaima Aug 17 '17 at 17:07
6
\$\begingroup\$

brainfuck, 579 bytes

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

Try it online!

Generates the constants 47 92 32 10 in memory, then selects and outputs them as appropriate.

\$\endgroup\$
  • \$\begingroup\$ I'm pretty sure this can be golfed down, especially that last part \$\endgroup\$ – Stan Strum May 25 '18 at 0:45
  • \$\begingroup\$ @StanStrum Feel free to give it a shot. I tried but couldn't find any nice way to express it, especially given BF's verbosity in conditionals. \$\endgroup\$ – Conor O'Brien May 25 '18 at 1:45
4
\$\begingroup\$

Bubblegum, 77 76 bytes

Hexdump:

0000000: 75cf c109 8000 0c43 d17b a6c8 0659 28fb  u......C.{...Y(.
0000010: cf21 05cb a782 3de9 4b5a b495 5b9f 4946  .!....=.KZ..[.IF
0000020: 870f dac3 f8ea 5704 51b9 2284 c611 0114  ......W.Q.".....
0000030: 9029 f09e ec67 2362 21e1 075e 2136 29b9  .)...g#b!..^!6).
0000040: 08b9 bf97 8939 cf33 ebbf d33e            .....9.3...>

Try it online!

Bubblegum threshold. :P

\$\endgroup\$
3
\$\begingroup\$

///, 166 bytes

/-/!#//,/%"//'/%#//&/!!//%/  //#/\\\/\\\///"/\\\\\\\\//!/%%/"
 "&!'"%
,&-,&-
% "&'!"&'
!"&#!,&#
! "!'&"!'
!,-&,-
!% "'-"!"'
&"#-,!"#
& #-!"!"
&#"'!,'"
&% "#&"#,
&&&!,

Try it online!

\$\endgroup\$
3
\$\begingroup\$

C (gcc), 377 bytes

char*r="2\\01 2\\14 2/2\\02 2\\12 2/2 2\\12 2/03 2\\10 2/4 2\\10 2/04 2\\8 2/6 2\\8 2/05 2\\6 2/8 2\\6 2/06 2\\4 2/10 2\\4 2/07 2\\2 2/4 2/2\\4 2\\2 2/08 2\\2/4 2/2 2\\4 2\\2/09 2/4 2/4 2\\4 2\\08 2/2\\2 2/6 2\\2 2/2\\011 2\\2/8 2\\2/2 2\\030 2\\";char d[9];main(i){do{if(*r==48)puts(""),r++;for(i=0;isdigit(*r);d[i++]=*r++);for(d[i]=0,i=atoi(d);i--;putchar(*r));}while(*r++);}

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Haskell, 161 160 bytes

foldr(\a->(++(' '<$[1..fromEnum a-last(96:[64|a<'`'])])++last("\\\\":["//"|a<'`'])))""<$>words"` `Na LbLb JdJc HfHd FhFe DjDf Bd`DBg @dbD@h ddDI `BfB`H b@h@k ~"

Try it online!

Spaces before \\ are encoded as lowercase letters and before // as uppercase letters where the number of spaces is the ASCII value minus 96 (or 64). Zero spaces is ` / @. The Spaces of each line are stored in reverse order, because the are consumes by a right-fold.

\$\endgroup\$
2
\$\begingroup\$

Charcoal, 51 bytes

P↘¹²→↘¹²↑P↗⁵→↗⁵↓P↘⁵→↘⁵↑P↗χ→↗χM¹¹↓M⁵←P↖¹²←↖¹²↓P↙χ←↙χ

Try it online!

Charcoal, 50 bytes

P↘χ→↘χ↑P↗⁵→↗⁵M⁵↑←P↙χ←↙χMχ↗‖MM¹⁸←P↖²←↖²J²⁷¦⁹P↘²→↘²¦

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Charcoal, 50 31 bytes

F²«↘¹²↗↗⁵↘↘⁵↗↗⁹Mχ↓M⁴←↖¹²↙↙χJ¹¦⁰

Try it online! Link is to verbose version.

I tried. (Also, I will point out that I did this completely on my own, even if it looks somewhat similar to the other one. [Shiz, I did it again. This is still different, by the way. :P])

\$\endgroup\$
2
\$\begingroup\$

Python 2, 197 bytes

print''.join(i>'/'and(i<'2'and['/','\\'][int(i)]*2or' '*int(i))or i for i in"""1
 19501
2193021
319 0419 0
41806180
51608160
61409 140
71204014120
8104021410
90404141
8012061201
921081021
99931""")

Try it online!

Uses the logic from the JS answer.

\$\endgroup\$
1
\$\begingroup\$

Jelly, 65 bytes

“<fṭY2Ẹ<ƭẹ£ʋ¥¹)Œ<Ẓ⁹ḣ⁶ıĠ\ṃṛ?04|ẏḌẉƙ+’b36⁶ẋ“ÇỴ$ñ⁵FḄ’Bị⁾\/¤ẋ€2¤żFs36

Try it online!

Returns a list of characters. TIO link has a footer to print on separate lines.

\$\endgroup\$
1
\$\begingroup\$

PHP, 186 bytes:

Both versions require PHP 5.5 or later.

Run with -nr or try them online


space compression gives the shortest alternative:

(double backslash mapped to 0, double slash to f, sapces compressed to digits)

while(~$c="0
1077f0
2066f2066f
3055f4055f
408f608f
506f806f
604f5504f
702f4f0402f
80f4f2040f
9f4f4040
8f02f602f0
560f80f20
87870"[$i++])echo+$c?str_pad("",$c):strtr($c,["\\\\",f=>"//"]);

PHP 7.1 yields warnings; replace +$c with $c>0 to fix.


base 64 encoded bitmap (187 bytes):

(mapped space to 00, newline to 01, double backslash to 10 and double slash to 11, then concatenated 3 "pixels" each to one character, prepended 1 and converted from binary to ASCII)

for(;$c=ord("d`@@@@yB@@@@p`@@@M@`@@C@H@@@t@`@@p@H@@M@B@@p@@`@M@@`C@@@H@t@@`pC`BCP@@l@p`Bt@@C@L@`BP@@xL@BCd@@@K@@Bpd@@@@@@@@@B"
[$i++]);)for($b=6;$b;)echo[" ","
","\\\\","//"][3&$c>>$b-=2];

(first linebreak for reading convenience; the other one is essential)

\$\endgroup\$
1
\$\begingroup\$

Bubblegum, 74 bytes

00000000: 758c 4b11 0400 0885 eea6 a081 85e8 9f63  u.K............c
00000010: 4fb2 7f4f 0e30 4f07 e5ed 7615 8613 e16f  O..O.0O...v....o
00000020: 321c ab89 d484 4a22 2591 8a48 45a0 2052  2.....J"%..HE. R
00000030: 809e dfd5 481e 3d0d 7a24 4d96 bc43 b2fd  ....H.=.z$M..C..
00000040: 96d3 cdbf fff9 7fa7 f300                 ..........

Try it online!

\$\endgroup\$
1
\$\begingroup\$

PowerShell, 221 220 bytes

$ofs=''
"b
 b$(' '*14)/b
$((2..6|%{' '*$_+"b$(($a=' '*(14-++$i*2)))/$(' '*$i*2)b$a/`n"}))   4b  /4/b4b  /
44b/4/  b4b/
44 /4/4b4b
44/b  /4  b  /b
44   b/44b/  b
$(' '*30)b"-replace4,'    '-replace'/','//'-replace'b','\\'

Try it online!

Fairly naïve approach (and 50 bytes worse than the JS answer, cringe). Anyone know of a way to do multiple -replaces in PowerShell?

-1 byte thanks to Veskah.

\$\endgroup\$
1
\$\begingroup\$

C# (Visual C# Interactive Compiler), 136 bytes

Contains null bytes and other unprintables, so here's a hexdump:

00000000  5f3d3e22 02043902 08310833 0c29102b  _=>"..9..1.3.).+
00000010  10211823 1419201b 18112813 1c091100  .!.#.. ...(.....
00000020  100b2001 11081003 25111012 21000918  .. .....%...!...
00000030  09022c01 20015c6e 78222e41 67677265  ..,. .\nx".Aggre
00000040  67617465 2822222c 28632c6a 293d3e63  gate("",(c,j)=>c
00000050  2b6e6577 20537472 696e6728 2720272c  +new String(' ',
00000060  6a2f3429 2b286a25 323e303f 222f2f22  j/4)+(j%2>0?"//"
00000070  3a40225c 5c22292b 286a2534 3e313f22  :@"\\")+(j%4>1?"
00000080  5c6e223a 22222929 ........ ........  \n":""))

And here is a version you can test, with the null bytes substituted with \0 for 2 extra bytes. By the way, thanks to @ASCII-only for saving a few bytes my using division and modulus instead of bitwise operators!

_=>"913)+!# (	\0 %!\0		, \nx".Aggregate("",(c,j)=>c+new String(' ',j/4)+(j%2>0?"//":@"\\")+(j%4>1?"\n":""))

Try it online!

Explanation

Each part of the logo is just 0+ spaces with either a \\ or a // at the end, plus maybe a newline. There are 52 of these. We first take the amount of spaces, and bitshift it right by two. Next we check if the string ends with // or \\. If it ends with //, we bitwise OR it by 1. Lastly we check if there will be a newline. If there is, we bitwise OR it by 2.

Step by step example

Consider this segment from line two:

              //

That's 14 spaces there. The binary representation of 14 is 00001110. We bitshift it to the left by 2, yielding 00111000. As we can see, the line ends with an //, so we bitwise OR it by 1 for 00111001. It is not followed by a newlines, so 00111001 is our final result. 00111001 is 57 which in turn is the char 9. Therefore, 9 is the char that encodes that segment. We just repeat it for all the segments, and we have our 52-byte magic string!

\$\endgroup\$
  • \$\begingroup\$ j>>2 -> j/4 \$\endgroup\$ – ASCII-only Mar 16 at 6:08
  • \$\begingroup\$ 124. also i think you can put the null-bytes in if you hand-craft the URL \$\endgroup\$ – ASCII-only Mar 16 at 6:10
  • \$\begingroup\$ in the explanation: bitshift left, not right. also list of strings is only if you return each line as its own string... you'll need the string.Concat here for it to be valid... \$\endgroup\$ – ASCII-only Mar 16 at 6:14
  • \$\begingroup\$ close, this is 143 whereas normal is 141 \$\endgroup\$ – ASCII-only Mar 16 at 6:25
  • \$\begingroup\$ @ASCII-only I am pretty sure returning a list of strings like this is allowed, but I'll add another solution just in case. However, is this valid: tio.run/##Sy7WTS7O/… \$\endgroup\$ – Embodiment of Ignorance Mar 18 at 2:51
0
\$\begingroup\$

C (gcc), 144 140 bytes

-4 bytes thanks to ceilingcat.

Each character in the string encodes a number of spaces to use before a certain string. If it's a lower-case letter (or a backtick), then the string is "\", and if upper-case or @, it's "//". A space signifies a newline.

f(c){for(char*s="` aN` bLbL cJdJ dHfH eFhF fDjD gBD`dB h@Dbd@ IDdd H`BfB` k@h@b ~";c=*s++;)printf("%*s",c%32+2,c<33?"\n":c<96?"//":"\\\\");}

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Suggest L"屜⼯"+95/c instead of c<96?"//":"\\\\" \$\endgroup\$ – ceilingcat Nov 20 '18 at 21:27

protected by Community Mar 13 at 20:38

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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