Have you mooed today?
CJam, 96
This uses a lot of nasty bytes, so here's a hex dump of it:
00000000 22 ee 51 1e 53 41 15 ee 51 20 53 41 15 9a 5f 5a |".Q.SA..Q SA.._Z|
00000010 b9 5f 41 15 8c 5f 41 f9 38 24 2a 15 7e 55 1c 5f |._A.._A.8$*.~U._|
00000020 b9 30 5f b9 41 15 a8 26 2a 26 2a 15 36 45 91 c3 |.0_.A..&*&*.6E..|
00000030 ed cb 41 f3 df eb 41 db 20 cb c9 41 e9 df c9 c3 |..A...A. ..A....|
00000040 f3 7f 45 36 15 22 7b 69 32 6d 64 5c 5f 63 5c 37 |..E6."{i2md\_c\7|
00000050 6d 64 22 20 5f 6f 2d 7c 7e 2e 22 3d 2a 3f 7d 2f |md" _o-|~."=*?}/|
You can run the file with the java interpreter; it may be necessary to use ISO-8859-1 encoding, such as:
java -Dfile.encoding=ISO-8859-1 …
Try it online
Equivalent (and much longer) ASCII version:
[238 81 30 83 65 21 238 81 32 83 65 21 154 95 90 185 95 65 21 140 95 65 249 56 36 42 21 126 85 28 95 185 48 95 185 65 21 168 38 42 38 42 21 54 69 145 195 237 203 65 243 223 235 65 219 32 203 201 65 233 223 201 195 243 127 69 54 21]:c
{i2md\_c\7md" _o-|~."=*?}/
Try it online
Explanation:
There are 7 characters that have repetitions: _o-|~.
. Each of them can be encoded as a number n from 0 to 6. For each repeating sequence, I am encoding both the character's index (n) and the number of repetitions (k) in a single byte: 2 * (k * 7 + n)
, written as a character with that code. And I am encoding any single characters as 2 * c + 1
, where c is the ASCII code. Everything goes in the initial string, and the rest of the program is decoding it:
{…}/ for each character in the string
i convert to integer (extended-ASCII code)
2md integer division by 2, obtaining the quotient (q) and remainder (r)
r decides whether it's a repetition or single character
\_ swap q and r, and duplicate q
c\ convert q to character and move it before the other q
this is for the r=1 case (single character)
7md divide q by 7, obtaining the quotient (k) and remainder (n)
"…"= get the corresponding character from that string (decoding n)
* repeat the character k times
? use the single character or the repetition, depending on r
Old version (109):
" H(_2)
H(o2)
B/-6\/
A/ | 4|2 3
9* 2/\-3/\
C~2 3~2 3
.6"{_'M,48>&{~*}&}/3/"Have you mooed today?"`*N
Try it online
Pyth, 100
r"17 (__)
17 (oo)
11 /6-\/
10 / |4 ||3
9 * /\\3-/\
12 ~~3 ~~3
3.\"Have you mooed today?\"3."9
Try it online: Demonstration
r"string"9
run-length-decodes the string.
edit:
Here's a 97 char solution: Demonstration. Very likely this is also 97 bytes (in iso-8859-1). But too tired for writing the bytes down and doing an explanation. Tomorrow evening, I guess.
Bash, 95 bytes
0000000: 7a 63 61 74 3c 3c 27 27 0a 1f 8b 08 01 01 01 01 01 zcat<<''.........
0000011: 02 03 53 40 07 1a f1 f1 9a 0a 5c 98 c2 f9 f9 a8 c2 ..S@......\......
0000022: fa ba 60 10 a3 8f 2c aa af 50 03 a2 6a 40 24 42 58 ..`...,..P..j@$BX
0000033: 0b 28 11 03 54 ab 1f 83 6a 70 5d 1d 8c e0 d2 d3 d3 .(..T...jp]......
0000044: 53 f2 48 2c 4b 55 a8 cc 2f 55 c8 cd cf 4f 4d 51 28 S.H,KU../U...OMQ(
0000055: c9 4f 49 ac b4 57 02 ca 70 01 .OI..W..p.
The above is a reversible hexdump. To create the file, execute
xxd -r -c 17 > 55918.sh
paste the hexdump and press Enter, then Ctrl + D.
To run created file, execute
bash 55918.sh 2>&-
Any other filename will do.
I chose zopfli as the compressor since it is compatible with the Coreutils program zcat and achieves better compression than gzip, bzip2 and xz.
zcat<<''
will read the following lines (until EOF) and feed them as input to zcat
.
Note that zcat will print a warning (since I stripped the checksum of the compressed file), as will bash (since the HEREDOC isn't terminated by an empty line). These warnings are printed to STDERR (suppressed by 2>&-
), which is allowed by default per consensus on Meta.