7
\$\begingroup\$

Introduction

You are probably familiar with the "puts on sunglasses" emoticon-meme:

(•_•)
( •_•)>⌐■-■
(⌐■_■)

In this challenge, your task is to take the first line as input, and output the last one, effectively putting sunglasses on that little button-eyed person. To make the task a bit more difficult, the characters have been scaled up and converted to (ugly) ASCII art.

Input

Your input is exactly this multi-line string, with an optional trailing newline:

   r                       t
  /                         \
 :                           :
 /    ,##.           ,##.    \
|     q##p           q##p     |
|      **             **      |
 \                           /
 :                           :
  \                         /
   L      ##########       j

Output

Your output is exactly this multi-line string, again with an optional trailing newline:

   r                                         t
  /                                           \
 :               ______             ______     :
 /              |######|           |######|    \
|     _______   |######|           |######|     |
|     #""""""   |######|           |######|     |
 \    #         |######|           |######|    /
 :    "          """"""             """"""     :
  \                                           /
   L                    ##########           j

Note that there are no trailing spaces in the input and output.

Rules and scoring

You can write a full program or a function. The lowest byte count wins, and standard loopholes are disallowed.

\$\endgroup\$
  • 4
    \$\begingroup\$ Is this really intended to be a kolmogorov-complexity question, meaning that any parsing of the input is not required and code that prints that particular output regardless of its input is ok? \$\endgroup\$ – pppery Feb 22 '16 at 18:52
  • 3
    \$\begingroup\$ @ppperry Ignoring the input is a valid strategy, yes. Your program may even crash if given any other input that that particular string. My intention was to have a "conditional Kolmogorov complexity" challenge: the task is to produce a fixed output, and you are also given access to some fixed auxiliary data that may or may not be helpful. I think giving the data as input is the cleanest way to do it (as opposed to something like "if this string appears verbatim in your source, subtract its length from your score"). \$\endgroup\$ – Zgarb Feb 22 '16 at 18:59
3
\$\begingroup\$

Retina, 210 161 156 133 bytes (ISO 8859-1 encoding)

Completely remade, doesn't care about input anymore.

s`.+
3r41t¶2/43\¶1:15,13,5:¶1/10 e\¶|5_,e |¶|5#'e |¶1\4#5 e/¶1:4"10'13'5:¶2\43/¶3L19 10$*#11j
e
3~11~4
~
|6$*#|
,
6$*_
'
6$*"
\d+
$* 

There is a trailing space at the end of last line. Also, a trailing newline is included in the output. If you want to suppress it, change the second last line to \`\d+

Old version, which uses parts of input in output:

( {3})(.+¶){3}.{10}( +)\S+( +).¶.( +)(.+¶){5}.+?(#+).+
$1rq te /q$1\e:pf,p$1,f:e/p$4~$3~$4\¶|f,_$1~$3~f|¶|f#'$1~$3~f|e\$4#$4f~$3~$4/e:$4"p'p$1'f:e \q$1/¶$1Lpp$7$3j
~
|6$*#|
,
6$*_
'
6$*"
q
pppp
p
ff
e
¶ 
f
5$* 

Try it online! (210-byte version)
Try it online! (161-byte version)
Try it online! (156-byte version)
Try it online! (133-byte version)

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

Bubblegum, 97 bytes

0000000: e001 e500 595d 0010 6818 841b 8ec4 c1cd  ....Y]..h.......
0000010: edc4 82fe b74a b6dd affc 98aa dccc 0d35  .....J.........5
0000020: 6869 7333 10ec f862 efbc 1475 9496 cacf  his3...b...u....
0000030: 5379 f091 507e 3df4 4a1d 51fc 98f7 4fb8  Sy..P~=.J.Q...O.
0000040: a8e0 2e3e 3b1b dc32 cbcf 5f0c d010 9d96  ...>;..2.._.....
0000050: 63e9 c49a fc44 60ef 7680 9b58 9027 c000  c....D`.v..X.'..
0000060: 00  

Compressed using LZMA. Try it online.

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

JavaScript (ES6), 200 bytes

a=>a.split`
`.map((l,i)=>l[s="slice"](0,6)+(["_7 3",'#"6 3',"# 9",'" 9'][i-4]||"  9")+(g=[" _5 ",x="|#5|",x,x,x,' "5 '][i-2]||" 7")+l[s](10,21)+g+l[s](25)).join`
`.replace(/.\d/g,m=>m[0].repeat(m[1]))

Explanation

Replaces the eyes of the input with run-length encoded glasses, then decodes them.

var solution =

a=>
  a.split`
`.map((l,i)=>                                      // for each line of the input
    l[s="slice"](0,6)                              // left outline
    +(["_7 3",'#"6 3',"# 9",'" 9'][i-4]||"  9")    // glasses frame
    +(g=[" _5 ",x="|#5|",x,x,x,' "5 '][i-2]||" 7") // left glasses lens
    +l[s](10,21)                                   // mouth
    +g                                             // right glasses lens
    +l[s](25)                                      // right outline
  )
  .join`
`                                                  // combine altered lines
  .replace(/.\d/g,m=>m[0].repeat(m[1]))            // run-length decoding

result.textContent = solution(
`   r                       t
  /                         \\
 :                           :
 /    ,##.           ,##.    \\
|     q##p           q##p     |
|      **             **      |
 \\                           /
 :                           :
  \\                         /
   L      ##########       j`
);
<pre id="result"></pre>

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

Python 3, 283 bytes

import zlib;print(zlib.decompress('x\x9cSPP(R \x16\x94p)(è\x13\xadZA!\x86KÁ\nM(\x1e\x0cp\tYq¡\x9b_£\x0c\x0658\x84b¸j\x90Ì\x88\'¬A¡\x06ªCY\t\x0c\x88Ò¡\x10\x03ÖA¬£ô¡ÞVBHÃ-Ã*\x04ô6Ä\n"\x01Ð\x02\x05\x05\x1fl2Êp\x80$\x98\x05\x00ð>KB\n'.encode('latin-1')).decode())

Try it online

Doing the encoding and decoding to deal with the fact that zlib.decompress expects a bytes object is about 30 bytes cheaper than just directly passing a bytes object:

import zlib;print(zlib.decompress(b'x\x9cSPP(R \x16\x94p)(\xe8\x13\xadZA!\x86K\xc1\nM(\x1e\x0cp\tYq\xa1\x9b_\xa3\x0c\x0658\x84b\xb8j\x90\xcc\x88\'\xacA\xa1\x06\xaaCY\t\x0c\x88\xd2\xa1\x10\x03\xd6A\xac\xa3\xf4\xa1\xdeVBH\xc3-\xc3*\x04\xf46\xc4\n"\x01\xd0\x02\x05\x05\x1fl2\xcap\x80$\x98\x05\x00\xf0>KB').decode())
\$\endgroup\$
0
\$\begingroup\$

05AB1E Osable, 174 bytes

Well, this was a mistake... 05AB1E doesn't have any compression built-in except for a dictionary compression method. Code:

2FSð18×sJ,}17÷\?'_6×Dð13×sð5×VY':J,ð'/ð14×J?'|'#6×'|JDð11×sð4×JUX'\J,'|Y'_7×ð3×Xð'|J,'|Y'#'"6×ð3×Xð'|J,ð'\ð4×'#ð9×X'/J,ð':ð4×'"ðT×'"6×Dð13×sY':J,\\\\\Sð18×sJ,5÷ð4×srð14×srJ?,

Try it online!

Uses CP-1252 encoding.

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

Python 2, 120 bytes

This source contains non-printable characters, so it is presented as a hexdump that can be decoded with xxd -r.

00000000: efbb bf70 7269 6e74 2778 018d cea7 1503  ...print'x......
00000010: 310c 5c30 50ae 29fe 3b0f 60ee 19b2 411a  1.\0P.).;.`...A.
00000020: 0f4b 81de 3dbd b7d3 67ea c246 d62e a8f2  .K..=...g..F....
00000030: 66a1 79b5 3cfb 956a a17a d1cb 59ff 919a  f.y.<..j.z..Y...
00000040: 4507 cb8b f101 3d3a 28c3 596a c20c 4af6  E.....=:(.Yj..J.
00000050: a91a 1a0c eeee c7be a65a 3093 5703 135f  .........Z0.W.._
00000060: 943b 0fab 03f0 3e4b 4227 2e64 6563 6f64  .;....>KB'.decod
00000070: 6528 277a 6970 2729                      e('zip')
\$\endgroup\$

Your Answer

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

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