# Pour me a drink, will you?

### The Challenge

I am thirsty and need a drink, but I don't know what to order. Your task is to provide me with either a drink or options for one.

### I/O

Input will be either a base or a drink name.

If given a base, your program should output one random drink from a list of drinks with that base. If given a drink name, your program should output the base that drink is made from.

Below is a list of drink names, ordered by their bases:

Absinthe:
Death in the Afternoon
Earthquake
Green Russians
Green Vesper
Moloko Plus

Beer:
Black and Tan
Black Velvet
Boilermaker
Irish Car Bomb

Brandy:
B&B
Brandy Alexander
French Connection
Horse's Neck
Sidecar

Cachaça:
Caipirinha
Leite de Onça
Quentão
Rabo-de-Galo
Royce

Gin:
Bramble
Casino
Clover Club Cocktail
Gin Fizz
Martini

Rum:
Bacardi
Cuba Libre
Daiquiri
El Presidente

Tequila:
El Toro Loco
Margarita
Paloma
Tequila Sunrise

Vodka:
Black Russian
Bloody Mary
Cosmopolitan
Kamikaze
Screwdriver

Whiskey:
Bourbon Lancer
Irish Coffee
Manhattan
Rusty Nail
Whiskey Sour


### Rules:

• Standard Loopholes are forbidden.
• If given a base, the program's output should be non-deterministic, meaning that multiple runs should result in different outputs.
• Accordingly, when given a drink name, the program's output should be deterministic, yielding the same result for drinks with the same base.
• You may assume the input will always be one of the bases or drink names in the list compiled above.
• You may choose to print characters such as ç, ñ and ã as c, n and a, respectively.
• You may accept I/O in any reasonable format.
• This is a challenge, so the shortest answer (in bytes) wins.

### Test Cases:

Input:                    Output (Any one of the following):
Absinthe                  Death in the Afternoon
Earthquake
Green Russians
Green Vesper
Moloko Plus

Beer                      Black and Tan
Black Velvet
Boilermaker
Irish Car Bomb

Brandy                    B&B
Brandy Alexander
French Connection
Horse's Neck
Sidecar

Cachaça                   Caipirinha
Leite de Onça
Quentão
Rabo-de-Galo
Royce

Gin                       Bramble
Casino
Clover Club Cocktail
Gin Fizz
Martini

Rum                       Bacardi
Cuba Libre
Daiquiri
El Presidente

Tequila                   El Toro Loco
Margarita
Paloma
Tequila Sunrise

Vodka                     Black Russian
Bloody Mary
Cosmopolitan
Kamikaze
Screwdriver

Whiskey                   Bourbon Lancer
Irish Coffee
Manhattan
Rusty Nail
Whiskey Sour


Likewise, the input can be any of the drink names in the output column. If so, the output should be the corresponding base.

• From the Sandbox Dec 6 '17 at 14:34
• @HyperNeutrino sure, no problem. Those are common in my language, so I think I just put them there automatically hahahah. I'll update the rules to account for that. Dec 6 '17 at 15:30
• @HyperNeutrino, kinda weird that a language that consists almost exclusively of Unicode characters can't handle Unicode characters...
– NH.
Dec 6 '17 at 20:38
• Damn now I want a drink at it's only 10am Dec 7 '17 at 1:57

# Jelly, 356 bytes

“%³“¥;ġŀṭṢDṡỌµ“Ñçḥ“)ụ_ƥÐ¬“(OE⁼Ọ“"³Ḟ'×ɱA8“tẊ“ßDæj|t³G“z⁸ƈƲe“¦¿¶“ßṆÑẆṇ8“©ŒẓġṾɠ×“¢(°“⁶oI“¬ĿḤẈX“ṫ°^iɱ“ıịṣXṆẠL“3!ṁ“©VṢ“¦ƈœƘNd]¶mḄœ“Ðv4WṁḌạYÐġȯḣɼ“¢ḅuɼḶŒß“AṠḍ*ɦ)!Ḷ¿µʋ“¡pK“¡ȯL“¦uż“¬5;“¥I¢q9ḅḋĖ“µ>Ƥøŀ“ ØÐ“¤^(“¡Il“£Ḅ#ṫ$⁽ø“€Uy“"ƭ/4¢ṫ“ƬƒN⁼A6+EẈṆ“8ɠ¹“½oŒLụ}ɗ“µṡ⁴“½Çj“€g©“ÆḄ²zị'“¥¹j“þk¥ÆṢ“C⁼ṭ¬'“¿®ı“÷Ụ;“1ṂY“?]ʂ“¢ȥ4Ɗh⁺“Œ\ẒƘḳ“µċ$“¦ʋȷ[Ɱ“¡?ƓṚĠk»
¢i³
¢_¢’¤%6¤¤¢+5X¤¤¢%6¤’¤?ị1£


Try it online!

Formula stolen from Colera Su but I think I can get it shorter in Jelly using a Jelly-mindset approach.

¢_¢

# Python 3, 693690686 687 bytes

Yeah, naive approach. I tried some compression methods, and this one seems to be the shortest.

-2 bytes thanks to HyperNeutrino.

EDIT: Bug fixed.

import random
v="Absinthe$Death in the Afternoon$Earthquake$Green Russians$Green Vesper$Moloko Plus$Beer$Black and Tan$Black Velvet$Boilermaker$Michelada$Irish Car Bomb$Brandy$B&B$Brandy Alexander$French Connection$Horse's Neck$Sidecar$Cachaca$Caipirinha$Leite de Onca$Quentao$Rabo-de-Galo$Royce$Gin$Bramble$Casino$Clover Club Cocktail$Gin Fizz$Martini$Rum$Bacardi$Cuba Libre$Daiquiri$El Presidente$Pina Colada$Tequila$El Toro Loco$Margarita$Matador$Paloma$Tequila Sunrise$Vodka$Black Russian$Bloody Mary$Cosmopolitan$Kamikaze$Screwdriver$Whiskey$Bourbon Lancer$Irish Coffee$Manhattan$Rusty Nail$Whiskey Sour".split('$');a=v.index(input());print(v[a-a%6if a%6else random.randint(1,5)+a])


Try it online!

• Thanks to the new rules you can save some bytes by getting rid of the accents. Dec 6 '17 at 15:34
• 637 bytes using Python 2 and string compression
– ovs
Dec 6 '17 at 20:56

# PHP, 681 680 676 661 646+1 bytes

gz version:

<?=($x=explode)(_,$x(X,strstr($d=gzinflate(base64_decode("RZHBbtswDIZfhaft1IeI3TYblnRZEmS6CbTM1IRlMqXkbs7Tj9lS7CCQBH6Sn36uusJSBwqPhHUAFvACVudKJqoSn9Dq8DbjSHFtRAL7uRRGKffyROVCFreadVTY5bmEhsjCltNAGXuMTcY0AkoPR5R7daL8TjU2ypls8uEWvxqXAVo0aHTqQmPesYTmUxP/pbDK9NsTlz4bSXKtilCq7JRf1Ap9LvBCaYwH7imhhRbTgAk98oWNZcC4Ia4EPcF3SRh/zCQVNe6x04eeHtaYvdAlUViz3B488/Uat+4BC99Api5TbNE909hmfSeDNs+ds6SxIuewn6fQ+FbrObZzh7Dhzig+Ir/NDhF3LOjqv848ZdgZFceVSuFIrsj4EeEwi1tCN9VRTWGjSW8or2hc0bOKvVrcOfSE4aT9iKHJqm6Vq5a70/dzxVbLpBfN3irxkIx+9caOH7/hxCNeKfwcuIy0fEQ46Gx+odk6FdigpP9H0vOZyAnc0nqb50vqAi/+/z8")),$argn.X))[1])[rand()%5]?:array_slice($x(X,strstr($d,$argn,1)),-2)[0];  strtr version, 676 661+1 bytes <?=($x=explode)(_,$x(X,strstr($d=strtr("Abs4theXDeath 4 the Aft2noon_E5thquake_Green Russi0s_Green Vesp2_Moloko PlusXBe2XMiche7da1 0d T01 Velvet_Boil2mak2_I8sh C5 BombXBr0dyXB&B_Br0dy Alex0d2_French Connection_Horse's Neck_Sidec5XCachacaXCaipi8nha_Leite de Onca_Quentao_Rabo-de-Galo_RoyceXG4XG4 Fizz9rt4i_Bramble_Cas4o_Clov2 Club CocktailXRumXBac5di_Cuba Libre_Daiqui8_P4a Co7da_El Presidente66 Sun8se_El Toro Loco9rg5ita9tador_PalomaXVodkaXBloody M5y1 Russi0_Cosmopolit0_Screwd8v2_Kamikaze33 Sour_Bourbon L0c2_I8sh Coffee9nhatt0_Rusty Nail",[an,_Black,er,XWhiskey,in,ar,XTequila,la,ri,_Ma]),$argn.X))[1])[rand()%5]?:array_slice($x(X,strstr($d,$argn,1)),-2)[0];


Run as pipe with -nF or try it online. Requires PHP 7.

# Python 2, 640 bytes

import random as r
def f(s):d="eJw9Ucty2zAM/BWc2lPwD5by6tRJXNvjniEKjjCiAAek0tpfXyij6UlYanexXG66IloHxnumOoAoBIDNubKrmeIDeR0+ZhoZn5xZYT+XIqRlhScuF3Z8sWyjwS7PBRuOgyZTGoG0hyPpik6cP7liY5LZp7AMnaSBM/WEP1zKAC05NDZ12Hhor9h8a9YRNpn/xhCiR2dNwTVVTlUi5bN54e8FXjmNeJCeEzm2lAZKFF+5iIsOhFuWytAzvGn8+DWzVjLcU2d3Pd89UQ5g1xR3FV32Tl3m0EdFhm22T3Zo89zF6jRWkrzw4FFuN3yJnkQF9/OETWz1XrCdO4KtdB7tknzMEQIfMuycS0TUyrgTpTD7KuDIwci0MI7mBltLtti+k0ulmCr15riLkNN/NhxmjeIYT9aPtPa8PlEgsyguPK7YWpnsYjmsFH/SJCPdGA/J+U/vEhfD34OUkaNym70zhS1piuP1Xex8Zo4Q0WJdLGJHvcLr0sEqhEMI/wHq6dVM".decode('base64').decode('zip').split('.');i=d.index(s);print d[[i+r.randint(1,5),i/6*6][i%6>0]]


Try it online!

• Use from random import* instead of import random as r, and omit the r. from r.randint, so it will save you 1 byte Mar 29 at 5:15

## PHP, 628 bytes

Stealing the best ideas from others... thanks for the inflate trick

<?$d=explode("|",gzinflate(base64_decode("PVHLctswDPwVnHrLR1hqHp06iWt73DNEwRVGFOCAVBp78Lc99Nw/KNTR9CQstbtYLjddYakD+WfCOgALBIDNuZKJqvg9Wh3eZhzJH41IYD+XwihlhScqFzJ/1qyjwi7PxRuKgyZjGgGlhyPKik6U36l6o5zJprAMHaeBMvboX4zLAC0aNDp13lhor958atYRNpk+YgjRg5Gk4KoIpcqR8kmtEBR4oTT6gXtKaN5iGvA3xpcvbCwD+pa4EvQErxI/vs0k9Zf6Hju96+nuEXMAvaa4K8uyd+oyhT4qUm+zvpNBm+cuVqexIueFBw98u/lz9MTCvp8nbzDW9+zt3CFsubNoF/ltjhB+n2FnVCKiVPId/8Ew+1fAkYKRcWEc1RS2mnSx/YHGFWOq2Kv5LkJO/9lwmCWKIz9pP+La8/pEgVSjuPC4eqtl0ovmsBL/ihOPeCM/JKOfvXFczL8PXEaKynW2TgW2KCmO13fR85koQkSLdbGIHfUKL0sHqxAOIfwL")));$i=array_search($argv[1],$d);echo($i%6)?$d[$i-$i%6]:$d[$i+rand(1,5)];

• You are wasting 22-1 bytes. But nice idea. Try <?=($d=explode(_,gzinflate(...)))[($i=array_flip($d)[$argn])‌​-($i%6?:-rand(1,5)]; with -nF and _ as separator instead of |. Dec 21 '17 at 17:23 # Charcoal, 381 375 bytes ≔⪪”}⊞J'%↓B+K…↙ZＱαyε↘¶⎚\⟲≧↑lⅉ＆⬤↖ΦüY⁹←‖⧴p×OＣ∧⊗F]±⊗✳Ｎ″ⅈ✳c∕lü,Π438↖⍘✳⍘⁷N⪪ςz↨Ｄ″≦«p¶↧⟦¬²◨▶↗⪫/_"b8n↨À⊙ρ≡1#▶UD⸿no,7φ²↘↑r‴m⪪pＷ⭆mC↥#pP″νr↧″h[κznβd6qυ:*…KC⪫⌈⸿＆DΣεＸMω⊙⟧↔Ｌ↓;?ü↶σ⁵%Ｆ⊙⪫:ＱD*)⊞↥$Ｘ4.⎆V\″Ｎb5βς｜…5¤⁴↘⊗｜%À⭆)⬤,⁻f»Ｄh…{“ [ＷＦ⸿⊗\$ς«8RbγＺ5gv⮌⟲Π\XcρO≦3；2{§³Ｑψt‹ＳY⪫ς⦃Ｄ⪫⎚TO⁼Ｎ⊗Ｅ⁺ζt≕·´H|›gＰＯＷkＫ⁶³⧴\⁶Ａ⊟ⅈ✂&)ξ↧εβ%ιSΦＹ\»ＸＷV⁸｜∧Ａ▷RE⍘Zα#÷Þ~↙{﹪ÞqＳＫ[μO\It›▷≕ρ≔⊘Jc◨;Ｚm�～8″⟲Ｐ↶S⎆2×”#δ≔⌕δθπ§δ⁻π∨﹪π⁶±⊕‽⁵


Try it online!

A port to Charcoal of Colera Su's answer. Link is to the verbose version of the code. I could not test some of the cases because Charcoal considers French Connection as two different inputs...

• 6 bytes saved thanks to Neil!
• Print(AtIndex(d,-(p,Or(Modulo(p,6),Negate(++(Random(5)))))); saves you a few bytes. Also, to stop Charcoal splitting on spaces, either a) append a trailing newline b) wrap the input in a list i.e. ["French Connection"].
– Neil
Dec 8 '17 at 10:56
• @Neil if you omit the last ; of your Print statement, the deverbosifier omits a ¦ at the end of the code and you can save one more byte. Dec 11 '17 at 14:53
• I guess that works... I always hate having to remove commas and semicolons though. (I need to remember to ask @ASCII-only to allow a ; before else...)
– Neil
Dec 11 '17 at 14:57