2
\$\begingroup\$

From here. Every new game is the first day of the month, 12:00 PM UTC.

The goal is to create the Stack Overflow logo using ASCII characters.

It looks like this.

Stack Overflow

The exact output should look like this:

        \\
          \\
     \=    \\
       \=    \\
         \=   \\
           \==  \\
    ¯¯¯       \==
       ¯¯¯¯¯
   _______  ¯¯¯¯
          ____
| ____________ |
|              |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

It must be worth mentioning that it must represent the same form of the actual logo, wherein the lines' (which I would call sticks) layering should be aligned as the way of the one from the picture. You can use either spaces or newlines to add another line for drawing the logo.

Remember, 5 sticks facing different angles and 1 tray holding them.

Can you draw it with the least bytes possible?

\$\endgroup\$
5
  • 5
    \$\begingroup\$ Drawing the graphical version of the logo would also be a great challenge, if it hasn’t been done before. \$\endgroup\$
    – Giraffe
    May 1 at 21:10
  • 1
    \$\begingroup\$ @Anush It sort of has, except that was a "popularity contest", not a code golf challenge. It does have an answer with ASCII art that looks better than what appears in this question, though; at least in my opinion. \$\endgroup\$
    – Cody Gray
    May 2 at 5:58
  • 1
    \$\begingroup\$ Awesome question. As an aside, it would be pretty cool to draw the logo exactly as-is (i.e. raster) \$\endgroup\$
    – stevec
    May 2 at 8:49
  • 4
    \$\begingroup\$ Note, the overline character you used isn't ASCII. \$\endgroup\$
    – kaya3
    May 2 at 10:50
  • 1
    \$\begingroup\$ -1 for using non-ASCII characters in an ASCII art challenge. \$\endgroup\$
    – DJMcMayhem
    May 15 at 22:03

15 Answers 15

9
\$\begingroup\$

Python 3, 121 120 108 bytes

Inspired by @Enzo's answer, this works very similarly, except it encodes using a bytestring instead of an integer in base 36. Thanks also to @xnor for shaving 12 bytes off.

Each character in the encoding is equal to chr(' |\\=_¯\n'.index(c) + 7*n + 28) where a symbol c should be repeated n times; the + 28 is just so it's in the printable ASCII range. The last repetition is encoded as ¯ 8 times twice, instead of ¯ 16 times, for the same reason.

for x in b'T,)b,)?%&8,)M%&8,)[%&1,)i%-*,)86M%-)MD)1Q*=)b<)$#t#$)$~$)YY':print(end=' |\=_¯\n'[x%7]*(x//7-4))

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Nice method! Some improvements for 108 bytes: using a bytestring to store the character values, writing print(end=...) directly to print without anything after, and not escaping a backslash which works because with the next character \= isn't a valid escape sequence. \$\endgroup\$
    – xnor
    May 2 at 5:02
  • \$\begingroup\$ @xnor Thanks for the tips, particularly because I didn't realise iterating over a bytestring gave integers; that's good to know. \$\endgroup\$
    – kaya3
    May 2 at 5:05
7
\$\begingroup\$

JavaScript (ES6), 154 bytes

_=>` 8#10#5\\= 4#7\\= 4#9\\= 3#11\\==  #4¯3 7\\==
 7¯5
 3_7  ¯4
 10_4
| _12 |
| 14|
¯16`.split`#`.join`\\2
 `.replace(/.(\d+)/g,(s,n)=>s[0].repeat(n))

Try it online!

\$\endgroup\$
6
\$\begingroup\$

Splinter, 160 153 bytes

A{\
}B{\ }C{BB}D{CC}E{DD}EF{\\}G{FFA}GCEGBDH{FI{\=}I}HDGR{BC}RDHDGEBHRGERHICGDK{\-}L{KK}KLRDHIARDM{LL}MKARN{\_}P{NNNN}NNNPCMAECPAQ{\|}QBPPPBQAQCDEQAMMMM

Try it online!

Note: Due to a bug in the interpreter, only 1-byte characters can be printed. If the interpreter worked properly, I could just replace the hyphen with an overline, printing the correct result.

\$\endgroup\$
5
  • \$\begingroup\$ Is it allowed to use hyphens instead of overlines? The difference is that an overline takes two bytes in UTF-8. \$\endgroup\$
    – kaya3
    May 2 at 14:47
  • \$\begingroup\$ @kaya3 Due to a bug in the interpreter, only 1-byte characters can be printed. If the interpreter worked properly, I could just replace the hyphen with an overline. You're right though, I'll change the bytecount by 1. \$\endgroup\$
    – emanresu A
    May 3 at 4:59
  • \$\begingroup\$ That's fair enough - I was unsure whether this was something allowed for other answers, that's all. \$\endgroup\$
    – kaya3
    May 3 at 5:44
  • \$\begingroup\$ How is this 153 bytes? The TIO link you provide still says 160 characters, and if you are still adjusting for macron, this should be 161. \$\endgroup\$
    – hyper-neutrino
    Jun 9 at 3:13
  • \$\begingroup\$ @hyper-neutrino Oops, forgot to update the TIO. My bad. \$\endgroup\$
    – emanresu A
    Jun 9 at 4:57
5
\$\begingroup\$

Python 3, 205 186 180 172 169 bytes

-8 bytes thanks to @kaya3

-4 bytes thanks to @Makonede

for i in range(58):m=int('7IPPQA9UU6JJAOWWU17I77P5ZEVJ0ASTQRZNTQCX7GD0BJ6Z2F6P6PBFO9DU4F4GFYC7ST87K89MCKVO9S08KDRI2O',36)>>i*8&255;print(end=' \\=¯_|\n'[m&7]*(m>>3&31))

Try it online!

Encodes the output into a integer in groups of 8 bits for each character. The first 5 bits represents the length of this character in the original output and the last 3 bits the character index in s.

Ungolfed:

g = int('7IPPQA9UU6JJAOWWU17I77P5ZEVJ0ASTQRZNTQCX7GD0BJ6Z2F6P6PBFO9DU4F4GFYC7ST87K89MCKVO9S08KDRI2O', 36)
s = ' \\=¯_|\n'                # Unique characters from the expected output
for i in range(58):            
    m = g >> i*8 & 255         # Gets the i-th group of 8 bits from the encoded integer
    i = m & 7                  # The last 3 bits: index of s
    n = m >> 3 & 31            # The first 5 bits: length of this character
    print(s[i] * n, end='')    # Prints it
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Nice one; the variables s and g are only used once each, so you could inline them to save a few bytes. I wrote another answer based on your method but using a string instead of an integer in base 36, which gives a more compact encoding. \$\endgroup\$
    – kaya3
    May 2 at 4:22
  • \$\begingroup\$ @kaya3 Your method is great, I was too lazy to think about a good encoding so I just went with base 36 :-p \$\endgroup\$
    – enzo
    May 2 at 14:17
  • 1
    \$\begingroup\$ -4 by using print(end=' \=¯_|\n'[m&7]*(m>>3&31)). \$\endgroup\$
    – Makonede
    May 10 at 16:42
4
\$\begingroup\$

Charcoal, 73 70 bytes

F³«F²¶\\←»↙F⁵«←…=⊕‹ι²↖¹»M⁴↓F354⁺¶×¯Iι↙↓↓²←ׯ¹⁶↗↑²↘→G→¹²_F47←⁺¶×_Iι

Try it online! Link is to verbose version of code. Note that there are only 69 66 characters but I think ¯ actually requires three bytes to encode since it's not in Charcoal's code page. Output includes leading blank line. Explanation:

F³«F²¶\\←»

Print the top right stick of \\s.

↙F⁵«←…=⊕‹ι²↖¹»

Print the stick of \=s.

M⁴↓F354⁺¶×¯Iι

Print the stick of ¯s.

↙↓↓²←ׯ¹⁶↗↑²

Print the box.

↘→G→¹²_

Print the horizontal stick of _s.

F47←⁺¶×_Iι

Print the other stick of _s.

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

Brainfuck 483 479 472 bytes

-4 bytes and fix the code thanks to Makonede

Yes... brainfuck, the best language to do ascii art :)

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

Try it by yourself

"Beautiful" version:

+[->---[-<]>-]>                 Create \
<<++++[>++++++++<-]>>>          Create space
>>>+[-[<+>>]<-]<--              Create =
>++++++++++                     Create line jump
>>+[<+>---]<++++>               Create weird minus sign
>-[<++>-----]<-------           Create _
>>--[<+>--]<---                 Create |
[<]>                            Return to the start and draw
........>..>>.[<]>
..........>..>>.[<]>
.....>.>.<<....>..>>.[<]>
.......>.>.<<....>..>>.[<]>
.........>.>.<<...>..>>.[<]>
...........>.>..<<..>..>>.[<]>
....>>>>...<<<<.......>.>..>.[<]>
.......>>>>.....<.[<]>
...>>>>>.......<<<<<..>>>>....<.[<]>
..........>>>>>....<<.
>>>.[<]>.[>]<<............[<]>.[>]<.<<<.
>>>.[<]>..............[>]<.<<<.
>................
\$\endgroup\$
4
  • \$\begingroup\$ Welcome to Code Golf, and nice first answer! There is no way I would've been able to do something like this without bfbrute :D \$\endgroup\$
    – Makonede
    May 10 at 16:10
  • \$\begingroup\$ This answer is invalid right now, actually, since the macron (U+00AF) must be used instead of the hyphen-minus. But you can replace +++++[<+++++++++>-] with +[<+>---]<++++>, which actually saves \$4\$ bytes over your current solution :) \$\endgroup\$
    – Makonede
    May 10 at 16:44
  • \$\begingroup\$ \$11\$ byte golf \$\endgroup\$
    – Makonede
    May 10 at 16:53
  • 1
    \$\begingroup\$ @Makonede It's true, Thank you so much \$\endgroup\$ May 10 at 19:12
3
\$\begingroup\$

V (vim), 85, 82, 81 bytes

i¸ \\3ñ2Ù2>jj>ñ2G6|4ñjR\= ñr=jS´ ³¯· \==
· µ¯
³ ·_  ´¯
± ´_
| ±²_ |
|±´ |ÙÒ¯

Try it online!

Hexdump:

00000000: 69b8 205c 5c1b 33f1 32d9 323e 6a6a 3ef1  i. \\.3.2.2>jj>.
00000010: 3247 367c 34f1 6a52 5c3d 20f1 723d 6a53  2G6|4.jR\= .r=jS
00000020: b420 b316 afb7 205c 3d3d 0db7 20b5 16af  . .... \==.. ...
00000030: 0db3 20b7 5f20 20b4 16af 0db1 20b4 5f0d  .. ._  ..... ._.
00000040: 7c20 b1b2 5f20 7c0d 7cb1 b420 7c1b d9d2  | .._ |.|.. |...
00000050: af                                       .
\$\endgroup\$
0
3
\$\begingroup\$

Julia, 112 108 105 bytes

b"YEibUib-ad%ib=ad%ibMaduibUealmib%w=alb=/bu;m'bU#bfeSkefbfU%fbGG".|>b->print("\\
_= |¯"[b%8]^(b%88÷8))

Try it online!

each character of the string contains the next index of the character to print and the amount of it: b%8 is the index of the character and b%88÷8 is the amount (maximum 10)

the characters are generated as follows: char = index + 8*amount + 88[if not printable]

(very similar to kaya3's answer and Enzo's answer)

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

JavaScript (Browser), 178 bytes

_='alert("~}}~ uw~}uw~w u}~su=  ~{¯su=ysv¯y}xx_  vy}sx_y| xxxx |y|}}s |yvvvv")~zzyww  {¯¯z\\\\y\\nx___w} v{{uz=s}w';for(i of'suvwxyz{}~')with(_.split(i))_=join(pop());eval(_)

Compressed using RegPack. A lot of JS1k submissions, including mine, went through RegPack to shave off some bytes.

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

Python 3, 176 bytes

Fairly straightforward use of variables to repeat parts of the string. The only slightly clever parts are to do with spaces - the print function uses ' ' as a separator by default, so each , in the argument list for print results in a space, saving two bytes compared to +s+ each time. The variables v and w are 3 and 8 spaces respectively, but *v with the unpacking operator results in 5 spaces.

I played around with it and found quite a lot of ways to make it 176 bytes, so there are probably a few more optimisations possible.

c,d,e,f,p,s,n='¯_=\\| \n'
a=f+f+n
b=f+e
v=s*3
w=s*8
print(w+a,w,a,v,b,v+a,*v,b,v+a+w,b+v+a+v+w+b+e+s,a,v+c*3,*v,b+e+n,*v,c*5+n+v+d*7+s,c*4+n,w,d*4+n+p,d*12,p+n+p,v,w,p+n+c*16)

Try it online!

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

///, 149 bytes

/0/¯¯¯//1/\\\\//2/   //3/22//4/__/3  11
 2311
  21= 211
 31= 211
231=   11
23  1==  11
 203 1==
 30¯¯
2_444  0¯
 3244
| 444444 |
|  33|
¯00000

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ second account? \$\endgroup\$
    – Razetime
    May 15 at 15:05
  • \$\begingroup\$ @Razetime Yeah, new account \$\endgroup\$
    – nph
    May 15 at 15:27
1
+50
\$\begingroup\$

Vyxal, 246 103 bytes

Try it online!

»Ẋ℅Ḋ↑↵S₈q⁋τGB¡:₀Ẏæ⁽₈;↔≬(ɾ₆^¾∑₂ġL4Ẋ>X¯[¹„⁋∵⟨⌈IR₅⌐∑wġb√AøĊd□≠⟇⅛]ṫ¯GȮd↓a«Ǐḣ1…9₍D€Cv↔₀:y-»»ø¾q»` \\=\¯|_
`Ŀ

Had to escape the dashes because otherwise string commpression: also doubled backslashes because they also need escaping. Apart from that, pretty clear (Edit 1: significantly golfed)

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

05AB1E, 85 84 bytes

•Ñ,ó r∍$±‘VY'ā±θʒć×zX[¬Ñˆãт²Ó₅ï=viÜLyƶ7eÖ¸¢¼“†…λ)’üƵĀÿ¹;ΣÃĀPJ¯12Q¦cI)Ù₄Í•"\ 
=¯_|"Åв

Try it online!

•...•"..."Åв  # trimmed program
          Åв  # push list of characters in...
     "..."    # literal...
          Åв  # with indices in base-10 values of base length of...
     "..."    # literal...
          Åв  # digits of...
•...•         # 598068322507306753885876761229106573443829774776514490536123134274531939033031756234422473798677424533439086479188876552508052865203429750266756699838477188150403473080434
              # implicit output
\$\endgroup\$
1
\$\begingroup\$

Jelly, 90 bytes

“£RƊsƇCṄʠUU¿¦ȦC@Ṗṛ¡Ṛȧw²{MXI⁼ḊĊƑ(ḅyỴɲṫ^ȦhİA_ḳGḶµBṙnYɓ@ƑSṚ)ṇƲẋ.ubƓ9ṚIJɓɼÆÐƭ’ṃ“ \¶=_|”;175Ọ¤¤

Try it online!

non-ascii in an ascii-art challenge is kinda sus

\$\endgroup\$
0
\$\begingroup\$

V (vim), 117 112 bytes

8á 2á\3Äj2é j4hi\= <esc>Ä}bb2é Äj2é 3lxÄj2é elr=ÄjelD9h3é¯ï7é 5á¯ï3é 7á_2á 4á¯ÙÒ $6X4á_ÙÒ_r|lr A |<esc>Ù<M-S>_/ 
ÙÒ¯

Try it online!

-5 bytes from DJMcMayhem.

This feels a bit too long for Vim, which I thought would work well for this challenge. I want to at the very least, beat one of the compressed answers.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy