Draw this Ascii coffee cup:

  o
o
o
__________
/          \__
|   J      |  \
|    A     |  |
|     V    |  |
|      A   |__/
\__________/

Brownie points for coffee-script or java :)

Shortest code in bytes, function or program, trailing newline or white space is acceptable, drink up!

• I'd be very suspicious of a cup of sparkling coffee. ;) – Dennis Feb 24 '17 at 14:22
• @Dennis it's my special coffee for Friday mornings ;) – Aaron Feb 24 '17 at 14:22
• Wouldn't be this more interesting with 2 or more drinks: the hot one would have vapors symbolized with “(” and “)”, the cold one sparkles? And by borrowing from Rod's comment, the code should display one or other based on current time. – manatwork Feb 24 '17 at 14:31
• Would it be acceptable to have trailing white space on lines? – Jonathan Allan Feb 24 '17 at 14:38
• @Aaron the cup don't have a good pattern, hard-coding/compressing will be shorter in many languages – Rod Feb 24 '17 at 14:55

# SOGL, 48 bytes

mγmλ⁶…Jcēņ▒&↓¡℮štΥ{ιE‽▼⅛÷εγ╝Ξ∫$■⌡πθ&χF׀▼ΡQ7L↓F¶‘  Explanation: SOGL has built-in string compression and one of the things it has is a char dictionary compression. Even better, it has a boxstring compression type where the only chars available are " /\|_-\n". So the whole program is a string encased in "‘ (the " is implicit). The string I gave the compressor are (escaped): " o\n o\n o\n ", "__________", "\n/ \\__\n| ", "J", " | \\\n| ", "A", " | |\n| ", "V", " | |\n| ", "A", " |__/\n\\", "__________", "/"  ## JavaScript (ES6), 110 104 bytes Saved 4 bytes thanks to edc65 let f = _=>1o 6o 3o 9 /44\\__ |2J5|1\\ |3A4|1| |4V3|1| |5A2|__/ \\9/.replace(/\d/g,n=>' _'[n>>3].repeat(++n)) console.log(f()) ### How it works The compression of the original ASCII art is achieved by replacing all sequences of 2 to 10 consecutive spaces and the two sequences of 10 consecutive underscores with a single digit: • Each sequence of N consecutive spaces is encoded with the digit N-1. • The underscore sequences are encoded with a 9. We use N-1 rather than N so that we never have to use more than one digit. Hence the need for ++n when decoding. The expression n>>3 (bitwise shift to the right) equals 0 for n = 1 to n = 7 and equals 1 for n = 8 (not used) and n = 9. Therefore, ' _'[n>>3] gives an underscore for 9, and a space for all other encountered values. The only special case is the sequence of 10 consecutive spaces just above "JAVA". Encoding it with a 9 would conflict with the underscore sequences. So we need to split it into two sequences of 5 spaces, encoded as 44. • I count 108 bytes (not counting f=). You can save 4 bytes this way: n>>3 instead of +!(n&7), 9 instead of _8 (twice) and 44 instead of 9 – edc65 Feb 24 '17 at 15:19 • @edc65 I've no idea why I counted f= in that one... Thanks for the saved bytes! – Arnauld Feb 24 '17 at 15:28 • Can you explain how the regex works a little bit? It appears like it replaced a digit d, with d spaces ('4' becomes ' '). But not sure exactly how it does that. What does the bit shift do? Why are we incrementing n? – Cruncher Feb 24 '17 at 16:33 • @Cruncher I've added a 'How it works' section. – Arnauld Feb 24 '17 at 17:22 • @Arnauld Very clever :) – Cruncher Feb 24 '17 at 17:43 # Jelly, 67 64 bytes -2 bytes thanks to Dennis (1. remove redundant ”, and 2. replace transpose and run-length decode, ZŒṙ, with reduce by element repetition, x/.) “Ñṁ{xGgṭḷVỤɲ8ṿfƬT9Ɱ¹=qṀS“$<(ƇỤ08ØÑḌṃṘX6~cuc8HṗḞ2’Dx/ị“ ¶_/\|JAVo


Try it online!

### How?

“...“...’ is a list of two base-250 compressed numbers:

[1021021021332411532617161526181616261916162618163425334, 2117114111551155121131612111415121115141211161312111551]


D converts to decimal to yield two lists of digits:

[[1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 3, 3, 2, 4, 1, 1, 5, 3, 2, 6, 1, 7, 1, 6, 1, 5, 2, 6, 1, 8, 1, 6, 1, 6, 2, 6, 1, 9, 1, 6, 1, 6, 2, 6, 1, 8, 1, 6, 3, 4, 2, 5, 3, 3, 4], [2, 1, 1, 7, 1, 1, 4, 1, 1, 1, 5, 5, 1, 1, 5, 5, 1, 2, 1, 1, 3, 1, 6, 1, 2, 1, 1, 1, 4, 1, 5, 1, 2, 1, 1, 1, 5, 1, 4, 1, 2, 1, 1, 1, 6, 1, 3, 1, 2, 1, 1, 1, 5, 5, 1]]


x/ reduces by element repetition to give one list of digits (repeating the number from the first list by the corresponding value of the other):

[1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 0, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 3, 2, 6, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 6, 1, 1, 5, 2, 6, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 6, 1, 1, 6, 2, 6, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 6, 1, 1, 6, 2, 6, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 6, 3, 3, 4, 2, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4]


ị instructs to index into the list of the right, one based and modularly (0 indexes into the rightmost item). The list on the right, ¶_/\|JAVo, is simply the character used in the required order where the pilcrow, ¶, is the same code-point as a linefeed. The closing partner of “ is not required as this is the end of the program:

[' ', ' ', 'o', '\n', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'o', '\n', ' ', ' ', ' ', ' ', 'o', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '\n', '/', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\\', '_', '_', '\n', '|', ' ', ' ', ' ', 'J', ' ', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', '\\', '\n', '|', ' ', ' ', ' ', ' ', 'A', ' ', ' ', ' ', ' ', ' ', '|', ' ', ' ', '|', '\n', '|', ' ', ' ', ' ', ' ', ' ', 'V', ' ', ' ', ' ', ' ', '|', ' ', ' ', '|', '\n', '|', ' ', ' ', ' ', ' ', ' ', ' ', 'A', ' ', ' ', ' ', '|', '_', '_', '/', '\n', '\\', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '/']


Jelly performs an implicit print of this list, which, since it contains characters, prints as if it were a string:

  o
o
o
__________
/          \__
|   J      |  \
|    A     |  |
|     V    |  |
|      A   |__/
\__________/

• I swear some of these languages are straight up compression algorithms – Cruncher Feb 24 '17 at 16:26
• @Cruncher that would be Bubblegum – Jonathan Allan Feb 24 '17 at 16:32
• Of course, any language that can output text longer than the code, must necessarily have code longer than the output text for some output texts. I assume if you tried to write something for a completely randomized input the code for it(unless you got lucky) would be longer? – Cruncher Feb 24 '17 at 16:38
• Yep if random. Bubblegum is actually using compression, the goal being Kolmogorov complexity challenges and hence the input should have pattern (or at least repetition like here). – Jonathan Allan Feb 24 '17 at 16:51
• The final ” is implicit and you can replace ZŒṙ with x/. Also, while it doesn't have any bytes, using ¶ instead of a literal newline makes the code more redable imo. – Dennis Feb 26 '17 at 13:43

# CoffeeScript ES6, 214 180 bytes

r="replace";" 1o0n0 6o0n0 3o0n0 _9n0/0 9b0_1n0|0 2J0 5|0 1b0n0|0 3A 4|0 1|0n0|0 4V0 3|0 1|0n0|0 5A0 2|0_1/0n0b0_9/0"[r](/\d/g,(a,b,c)->c[b-1].repeat(a))[r](/n/g,"\n")[r](/b/g,"\\")


# CoffeeScript, 135 bytes with hardcoding

f=()->"""  o
o
o
__________
/          \__
|   J      |  \\
|    A     |  |
|     V    |  |
|      A   |__/
\__________/"""

• No up/down vote; I don't like this answer because generally the point in a kolmogorov-complexity answer is to generate the output without using the entire thing in the code. – HyperNeutrino Feb 24 '17 at 14:37
• @HyperNeutrino, I agree, working on improving it. – Tom Feb 24 '17 at 14:39

# Python 2, 174172171 167 bytes

No hard-coding.
No Base-64 encoding.
No Regex.

k=' '
q='_'*10
print'\n'.join([k*i+'o'for i in 2,7,4]+[k+q]+['/'+k*10+'\\__']+['|'+k*s+'JAVA'[s-3]+k*(9-s)+'|'+' _'[s==6]*2+'\\||/'[s-3]for s in 3,4,5,6]+['\\'+q+'/'])


Saved 2 bytes by externalizing '_'*10 and by exploiting Python's conversion of True -> 1 and False -> 0.
Saved 1 byte by removing unnecessary whitespace.
Saved 4 bytes thanks to @TuukkaX!

• You seem to have 2 useless whitespaces at ] for and in [. – Yytsi Feb 25 '17 at 7:07
• Actually, you can shorten [2,7,4] and [3,4,5,6] to 2,4,7 and 3,4,5,6. – Yytsi Feb 25 '17 at 7:09

# PowerShell, 136124123 105 bytes

"""2o
7o
4o
$(($a='_'*10))
/55\__
|3J6|2\
|4A5|2|
|5V4|2|
|6A3|__/
\$a/"""-replace'(\d)','$(" "*$1)'|iex  Try it online! Thanks to @briantist for finding the shorter -replace method that I knew was there somewhere. This takes the string with numbers in place of the requisite number of spaces. We then regex -replace the digits with a script expression $(" "*$1). So, for example, the first line of the string will be $(" "*2)o, the second will be $(" "*7)o and so on. Because of the triple-quoting, this is left as a string on the pipeline. We dump that to iex (short for Invoke-Expression and similar to eval), which processes the script expressions and leaves the resulting multi-line string on the pipeline. Output is implicit. • That's strange, hardcoding is shorter. Hm. +1 anyway :) – HyperNeutrino Feb 24 '17 at 14:47 • I was hoping for some answers using innovative (huffman) coding schemas, but my python implementation is still coming up longer as well.. – Aaron Feb 24 '17 at 14:54 • for some reason the short-hand if/else doesn't seem to work ($_,' '*$_)[+$_-in48..57] - no matter what I change it seems to fail for me. – colsw Feb 24 '17 at 17:43
• @ConnorLSW That's because both expressions are evaluated and the array built before the indexing happens. As a result, PowerShell doesn't know how to multiply space by o and barfs. – AdmBorkBork Feb 24 '17 at 17:54
• @briantist Thanks for finding that! I knew it was there, just couldn't come up with the right combination of quotes to get it to work. – AdmBorkBork Feb 27 '17 at 13:47

\d
$*  (there's a trailing space at the end) Try it online! The principle is still having a "compressed" string from which the cup of coffee can be reconstructed by substitutions. Trying different substitutions it turned out that the only ones worth doing are: • = turns into __________ (10 underscores) • any digit turns into that number of spaces # Common Lisp, 125123122120 114 bytes (format t"~3@{~vto ~} ~10@{_~} /~11t\\__ | J~11t| \\ ~2@{|~5t~a~11t| | ~}|~7tA |__/ \\~10{_~}/"2 7 4'A" V"1)  I saved 6 bytes, using idea of just putting enters in string instead of ~&s. Ideas for improvement welcomed. # Python3, 206 bytes print(' o\n'+7*' '+'o\n'+4*' '+'o\n'+' '+10*'_'+'\n'+'/'+10*' '+'\__\n'+'|'+3*' '+'J'+6*' '+'| \\\n'+'|'+4*' '+'A'+5*' '+'| |\n'+'|'+5*' '+'V'+4*' '+'| |\n'+'|'+6*' '+'A'+3*' '+'|__/\n'+'\\'+10*'_'+'/')  • So many space characters… Better declare a s=' ' variable and use it. – manatwork Feb 24 '17 at 14:36 • Also wouldn't hurt to predefine newline – Post Rock Garf Hunter Feb 24 '17 at 14:37 • Hardcoding the output is shorter – Kritixi Lithos Feb 24 '17 at 14:41 • @WheatWizard, I don't think so. There is only a single solitary newline. The others are inside strings, so using a variable would also need a concatenation operator. And 'o\n' has the same length as 'o'+n. – manatwork Feb 24 '17 at 15:50 • @manatwork One could: print(*(' o',7*' '+'o',4*' '+'o',' '+10*'_','/'+10*' '+'\__','|'+3*' '+'J'+6*' '+'| \\','|'+4*' '+'A'+5*' '+'| |','|'+5*' '+'V'+4*' '+'| |','|'+6*' '+'A'+3*' '+'|__/','\\'+10*'_'+'/'),sep='\n') or for x in(' o',7*' '+'o',4*' '+'o',' '+10*'_','/'+10*' '+'\__','|'+3*' '+'J'+6*' '+'| \\','|'+4*' '+'A'+5*' '+'| |','|'+5*' '+'V'+4*' '+'| |','|'+6*' '+'A'+3*' '+'|__/','\\'+10*'_'+'/'):print(x), both are 197. Still longer than a 136 hard code. – Jonathan Allan Feb 24 '17 at 16:02 # Pyth, 80 bytes r" o 7 o 4 o 10_ /10 \__ |3 J6 | \\ |4 A5 | | |5 V4 | | |6 A3 |__/ \\10_/"9  Online interpreter available here. Simple run-length decoding. # C - 179 Solution with extensive use of format string: void f(){printf("%1$3c\n%1$8c\n%1$5c\n%2$11s\n/%3$13s\n|%4$4c%5$7c%6$3c\n|%7$5c%5$6c%5$3c\n|%8$6c%5$5c%5$3c\n|%7$7c%5$4c__/\n\\%2$s/\n",'o',"__________","\\__",74,'|',92,65,86);}


Here is a more readable version:

void f() {
printf("%1$3c\n" "%1$8c\n"
"%1$5c\n" "%2$11s\n"
"/%3$13s\n" "|%4$4c%5$7c%6$3c\n"
"|%7$5c%5$6c%5$3c\n" "|%8$6c%5$5c%5$3c\n"
"|%7$7c%5$4c__/\n"
6o
3o
9
/44\\__
|2J5|1\\
|3A4|1|
|4V3|1|
|5A2|__/
\\9/"[$i++];)echo$c>0?str_repeat(" _"[$c>8],$c+1):$c;  This looks a lot like Arnauld´s answer - and does pretty much the same. Run with -r. # zsh, 86 bytes printf "^_<8b>^H^@^@^@^@^@^B^CSPÈçR^@^A^P^CJÆÃ^A<97>¾^B^\Ä^@¹5@Ú^KÂ^E2cÀ|^EG^X¿^FÂW^HCæÃTÔÄÇësÅÀ^L^Fq^@<92>}ý^?{^@^@^@"|zcat  Explanation: that string is the gzip-compressed java cup ascii art. I use printf, because with echo, zcat prints a warning, and echo -e is one character longer. It doesn't work with bash or sh, because they think it's a binary file. Since you can't effectively paste that output from the browser, here's a usable file. # Java 9 / JShell, 299 bytes ()->{String s="";BigInteger b=new BigInteger("43ljxwxunmd9l9jcb3w0rylqzbs62sy1zk7gak5836c2lv5t36ej6682n2pyucm7gkm9bkfbn4ttn0gltbscvbttifvtdfetxorj6mmy3mt6r3",36);while(!b.equals(BigInteger.ZERO)){int x=b.intValue()&0x3ff;for(int i=0;i<x>>7;i++)s+=' ';s+=(char)(x&0x7f);b=b.shiftRight(10);}return s;}  Ungolfed: () -> { String s = ""; BigInteger b = new BigInteger( "43ljxwxunmd9l9jcb3w0rylqzbs62sy1zk7gak5836c2lv5t36ej6682n2pyucm7gkm9bkfbn4ttn0gltbscvbttifvtdfetxorj6mmy3mt6r3", 36); while (!b.equals(BigInteger.ZERO)) { int x = b.intValue() & 0x3ff; for (int i = 0; i < x >> 7; i++) s+=' '; s += (char)(x&0x7f); b = b.shiftRight(10); } return s; }  Usage in JShell: Supplier<String> golf = <lambda expression> System.out.println(golf.get())  Encodes each character as ten bits consisting of a count of the number of spaces before the character in the high three bits following by the code point in the low seven bits. (Since there are only three bits for the count it can't represent more than seven consecutive spaces, and there are ten spaces at one point in the string. These are encoded as a count of six, followed by a space, and then a count of three followed by the next character.) Sadly, it loses to this trivial 140-byte Java solution: ()->" o\n o\n o\n __________\n/ \\__\n| J | \\\n| A | |\n| V | |\n| A |__/\n\\__________/"  # 05AB1E, 85 bytes •1d'uì[_ÍpH»Ð]jŠ$ÿ{É˜ß|ªpå±W¾Ö:ÞjÇ&@è\$´Öàˆå]Á¢šBg¦ï&-ã¥ønØ7Ñà'?•9B8ÝJ"o _/\|JAV"‡15ô»


Try it online!