8
\$\begingroup\$

99 Varieties of Dosa is a popular chain of roadside dosa stalls across South India. This is inspired by a combination of this chain and the classic CodeGolf challenge "99 Bottles of Beer".

Recreate the variant of the menu of the popular '99 Varieties of Dosa' listed below.

(Note: Despite the name, the list contains 103 varieties and not exactly 99)

The desired output is the following list (in any order):

Sada Dosa
Cheese Sada Dosa
Paneer Sada Dosa
Paneer Cheese Sada Dosa
Schezwan Sada Dosa
Cheese Schezwan Sada Dosa
Paneer Schezwan Sada Dosa
Paneer Cheese Schezwan Sada Dosa
Onion Sada Dosa
Cheese Onion Sada Dosa
Paneer Onion Sada Dosa
Paneer Cheese Onion Sada Dosa
Chutney Dosa
Cheese Chutney Dosa
Paneer Chutney Dosa
Paneer Cheese Chutney Dosa
Tomato Onion Dosa
Cheese Tomato Onion Dosa
Paneer Tomato Onion Dosa
Paneer Cheese Tomato Onion Dosa
Schezwan Onion Dosa
Cheese Schezwan Onion Dosa
Paneer Schezwan Onion Dosa
Paneer Cheese Schezwan Onion Dosa
Jain Dosa
Jain Cheese Dosa
Jain Paneer Dosa
Jain Paneer Cheese Dosa
Masala Dosa
Cheese Masala Dosa
Paneer Masala Dosa
Paneer Cheese Masala Dosa
Onion Masala Dosa
Onion Paneer Masala Dosa
Cheese Onion Masala Dosa
Paneer Cheese Onion Masala Dosa
Schezwan Masala Dosa
Cheese Schezwan Masala Dosa
Paneer Schezwan Masala Dosa
Paneer Cheese Schezwan Masala Dosa
Mysore Masala Dosa
Paneer Mysore Masala Dosa
Cheese Mysore Masala Dosa
Paneer Cheese Mysore Masala Dosa
Paneer Cheese Schezwan Mysore Masala Dosa
Kerala Dosa
Kerala Cheese Dosa
Paneer Kerala Dosa
Paneer Cheese Kerala Dosa
Pav Bhaji Dosa
Pav Bhaji Cheese Dosa
Pav Bhaji Paneer Dosa
Pav Bhaji Cheese Paneer Dosa
Spring Vegetable Dosa
Spring Paneer Vegetable Dosa
Spring Cheese Vegetable Dosa
Spring Paneer Cheese Vegetable Dosa
Sweet Corn Dosa
Sweet Corn Cheese Dosa
Sweet Corn Paneer Dosa
Sweet Corn Paneer Cheese Dosa
Sweet Corn Schezwan Dosa
Sweet Corn Schezwan Paneer Dosa
Sweet Corn Schezwan Cheese Dosa
Sweet Corn Schezwan Paneer Cheese Dosa
Sweet Corn Mushroom Dosa
Sweet Corn Mushroom Paneer Dosa
Sweet Corn Mushroom Cheese Dosa
Sweet Corn Mushroom Paneer Cheese Dosa
Mushroom Dosa
Mushroom Cheese Dosa
Mushroom Paneer Dosa
Mushroom Paneer Cheese Dosa
Schezwan Mushroom Dosa
Schezwan Mushroom Paneer Dosa
Schezwan Mushroom Cheese Dosa
Schezwan Corn Mushroom Paneer Cheese Dosa
Paneer Chilli Dosa
Paneer Chilli Cheese Dosa
Mushroom Chilli Dosa
Mushroom Chilli Cheese Dosa
Mushroom Chilli Paneer Dosa
Mushroom Chilli Paneer Cheese Dosa
Sada Uttappam Dosa
Sada Uttappam Cheese Dosa
Sada Uttappam Paneer Dosa
Sada Uttappam Paneer Cheese Dosa
Onion Uttappam Dosa
Onion Uttappam Cheese Dosa
Onion Uttappam Paneer Dosa
Onion Uttappam Paneer Cheese Dosa
Masala Uttappam Dosa
Masala Uttappam Cheese Dosa
Masala Uttappam Paneer Dosa
Masala Uttappam Paneer Cheese Dosa
Mysore Uttappam Dosa
Mysore Uttappam Cheese Dosa
Mysore Uttappam Paneer Dosa
Mysore Uttappam Paneer Cheese Dosa
Mixed Uttappam Dosa
Mixed Uttappam Cheese Dosa
Mixed Uttappam Paneer Dosa
Mixed Uttappam Paneer Cheese Dosa
\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Mego Apr 19 '18 at 2:27
  • \$\begingroup\$ This is code golf and not fastest gun. You should give the challenge some time (a week or so) before accepting an answer. But you can always change the accepted answer. \$\endgroup\$ – Titus Apr 23 '18 at 5:18
9
\$\begingroup\$

Python 2, 503 496 487 485 479 476 bytes

for l in[a+'86'[i<2:1+i%2][::2*('v'in a)-1]+b for i in(0,1,2,3)for a,b in[l.split('~')for l in('~11~'[i<2::2]+'0|Spring ~Vegetable |73~|13~|03~|:3~|Mixed 3~|~7|~27|~17|;4~|;42~|;45~|~Tomato 1|~21|~Chutney |2'+'45~|~20|~:0|~0|Jain ~|Pav Bhaji ~|5~|59~|'[i<3:]+'<~~<'[i%2::2]).split('|')]]+['682:0','69','698']:
 for i in range(13):l=l.replace(chr(48+i),'Masala Onion Schezwan Uttappam Corn Mushroom Paneer Sada Cheese Chilli Mysore Sweet Kerala'.split()[i]+' ')
 print l+'Dosa'

Try it online!

Every dosa is of the form a [Paneer, Cheese] b Dosa

Each dosa is then encoded in a list of tuples of (a,b). There are many dosa where a or b is empty.

For each of these tuples, every combination of Paneerand Cheese is added in between them.

  • .. '86'[i<2:1+i%2] .. for i in(0,1,2,3) ..

The few special cases which are slightly different are:

  • Kerala Dosa, Kerala Cheese Dosa vs Paneer Kerala Dosa, Paneer Cheese Kerala Dosa
    • Kerala is moved from a to b if we have Paneer
    • .. '<~~<'[i%2::2] .. which gives ['Kerala',''] or ['','Kerala']
  • Schezwan Corn Mushroom Paneer Cheese Dosa
    • Corn is inserted if we have Paneer Cheese
    • .. '4..'[i<3:] ..
  • Onion Masala Dosa, Onion Paneer Masala Dosa vs Cheese Onion Masala Dosa, Paneer Cheese Onion Masala Dosa
    • Onion is moved from a to b if we have Cheese
    • .. '~11~'[i<2::2] .., similar to Kerala above
  • Pav Bhaji Cheese Paneer Dosa
    • Paneer and Cheese are swapped if a is Pav Bhaji
    • .. '86'[i<2:1+i%2][::2*('v'in a)-1] ..
  • Paneer Cheese Schezwan Mysore Masala,Paneer Chilli,Paneer Chilli Cheese
    • These are too different to account for, and are just added to the list at the end.
    • .. +['682:0','69','698']

At the end, the numbers are replaced with the correct words:

0123456789:;< -> Masala Onion Schezwan Uttappam Corn Mushroom Paneer Sada Cheese Chilli Mysore Sweet Kerala

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

Retina 0.8.2, 339 bytes


19¶149¶169¶1Chutney ¶1Tomato 6¶146¶Jain 1¶13¶163¶143¶183¶/-483¶;0¶/0;¶Pav Bhaji 1¶Spring 1Vegetable ¶71¶741¶751¶51¶450¶45/¶4Corn 5/-¶/:0¶5:1¶92¶62¶32¶82¶Mixed 2
%(`$
Dosa
2
Uttappam 1
1
0$'¶$`/0
0
$%'¶$%`-
/63
6/3
i /-
i -/
/
Paneer 
-
Cheese 
;
Kerala 
:
Chilli 
9
Sada 
8
Mysore 
7
Sweet Corn 
6
Onion 
5
Mushroom 
4
Schezwan 
3
Masala 

Try it online! This was 299 bytes before I discovered the edge cases...

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

Python 2, 436 bytes

00000000: 2363 6f64 696e 673a 3433 370a 696d 706f  #coding:437.impo
00000010: 7274 207a 6c69 620a 7072 696e 7420 7a6c  rt zlib.print zl
00000020: 6962 2e64 6563 6f6d 7072 6573 7328 2278  ib.decompress("x
00000030: da8d 554b 72c3 200c ddf7 14be 9a92 6862  ..UKr. .......hb
00000040: 52db 780c 499a 9ebe ed04 1309 3d91 eeec  R.x.I.......=...
00000050: f705 e1c1 894e 349c 62a2 8fe3 c89c 7848  .....N4.b.....xH
00000060: 1558 6961 de2c 6084 e917 f9be d35c 22a0  .Xia.,`......\".
00000070: 5d63 993d d565 7c6b 5c42 0425 2d5c 5c72  ]c.=.e|k\B.%-\\r
00000080: 1cd8 311d c76b 5ef8 a182 1556 ed08 b3f2  ..1..k^....V....
00000090: 1c67 cab1 d4c8 504b 9414 9770 8d75 44b6  .g....PK...p.uD.
000000a0: 0551 ede4 dd26 a4b8 5090 4f45 f902 4a82  .Q...&..P.OE..J.
000000b0: 01a4 70a6 4493 3e3b 0915 0780 80f8 b934  ..p.D.>;.......4
000000c0: 8b80 1075 e27e bae5 eb1c 401a e4da 09fb  ...u.~....@.....
000000d0: 6550 323f 52dc f04c 2cb3 cfc4 f5fc 57f0  eP2?R..L,.....W.
000000e0: 5a8a 557e f2d6 3ecb 032d 4152 a5b3 3573  Z.U~..>..-AR..5s
000000f0: 1b0e 235d 42fb aa13 7754 7e50 462b c9b4  ..#]B...wT~PF+..
00000100: 6e61 390f 373e 73a6 c3c4 5c6e 2d42 4c96  na9.7>s...\n-BL.
00000110: b0ae d3d1 dc99 f370 8cdb 62de e56e 04ac  .......p..b..n..
00000120: 566c 60c7 548f c625 9cd8 cabf 0bee f7cf  Vl`.T..%........
00000130: d734 6e31 ce3e e1f4 57fe 5d30 ba25 5429  .4n1.>..W.]0.%T)
00000140: 4c82 f5bd ccd7 37ae 7764 60b5 1fc3 c2c8  L.....7.wd`.....
00000150: b71b aa50 98a6 8020 b835 296f c19e 018e  ...P... .5)o....
00000160: 4473 6a1b 7f7f c06b ceb4 ae34 23c8 17ab  Dsj....k...4#...
00000170: 5921 465a 9fb7 ab2e 6ab0 8e5c 5661 5c6e  Y!FZ....j..\Va\n
00000180: fc67 7459 0bf6 0c6a 8698 53f6 e7c5 d9f4  .gtY...j..S.....
00000190: 3560 cfa0 fa30 a7ec e18b 4f6d 9dc6 3a72  5`...0....Om..:r
000001a0: 5506 2961 fe01 a6fe babb 2229 2e74 6974  U.)a......").tit
000001b0: 6c65 2829                                le()

Decompresses the string sada dosa\ncheese sada dosa\n…\n, and prints the result in title case.

Here is a Bash script that creates the program, prints its size and hexdump, and runs it.

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

JavaScript (Node.js), 602 bytes

thanks for @Shaggy for updating according to new menu and usage of base 36 + array split :)

_=>`0
10
20
210
30
130
230
2130
40
140
240
2140
5
15
25
215
64
164
264
2164
34
134
234
2134
7
71
72
721
8
18
28
218
48
428
148
2148
38
138
238
2138
98
298
198
2198
21398
a
a1
2a
21a
b
b1
b2
b12
cd
c2d
c1d
c21d
f
f1
f2
f21
f3
f32
f31
f321
fg
fg2
fg1
fg21
g
g1
g2
g21
3g
3g2
3g1
3eg21
2h
2h1
gh
gh1
gh2
gh21
0i
0i1
0i2
0i21
4i
4i1
4i2
4i21
8i
8i1
8i2
8i21
9i
9i1
9i2
9i21
ji
ji1
ji2
ji21`.replace(/.|$/mg,x=>x?`Sada,Cheese,Paneer,Schezwan,Onion,Chutney,Tomato,Jain,Masala,Mysore,Kerala,Pav Bhaji,Spring,Vegetable,${c=`Corn`},Sweet ${c},Mushroom,Chilli,Uttappam,Mixed`.split`,`[parseInt(x,20)]+` `:`Dosa`)

Try it online!

\$\endgroup\$
  • \$\begingroup\$ o="Uttappam", "Mixed "+o <- that's clever, didn;t know you could do this \$\endgroup\$ – The random guy Apr 18 '18 at 7:08
  • 2
    \$\begingroup\$ 690 bytes \$\endgroup\$ – Shaggy Apr 18 '18 at 7:33
  • 1
    \$\begingroup\$ 629 bytes \$\endgroup\$ – Shaggy Apr 18 '18 at 9:16
  • \$\begingroup\$ or 577 bytes with RegPack. \$\endgroup\$ – Arnauld Apr 18 '18 at 9:43
  • 1
    \$\begingroup\$ 602 bytes - tempted to post it myself at this rate! \$\endgroup\$ – Shaggy Apr 18 '18 at 13:55
1
\$\begingroup\$

05AB1E, 380 bytes

“³ŽÞÄ枎¹ÕŸÊÃŦ«“ð.•.ÚÜāÚÕuƒÚ·@â¥αm橽â…]M<.žk¦L0ηβ½ζ‰I°¸6þÈÑÈ)º#θ›34ù±q
œƒé•J™#
•yÊ£‰RÒ‡¨ÃιUÄŽn¾₅&p’ûüL1Ç*¶‡A¶„Ωðw#õqλ₆µŸÜ∊∊îà½Í*üÞ–´YΛæz…ć<þ‹Ž¡‡wBćèú₃Pjæ
†Oò;ÊāxµÏŒSv>H£Yœ<нΘ—[é”B‹āÕ×r₁t‡ù@l4ÐθÃ-R¨„“gt–å¶
∍»´₂*N§¨н∊í6ζ`pzÈ’v,q/äwájιìƤ”G₅Qαbbi'M?–’fт¥V2ÍÓ‡Žý+2≠Sf)A—+7-ù¯>v:͵K‘?˜6·Å₂!1 ćæQ1|iт†Ä"тë₄æ~…àÉÃùpû›ã~[и/±ÌðQÔāoĆ¹β«"CÜŽ›0∊/pâŒlλMÃ”Σ»<ˆŸcΑ€øPΛʒ=Ā5æVŽĆæ•23B'M¡€S22öè»

Try it online!

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

///, 540 bytes

/=/0\/\///;/-=`/<21//./5=,/3=>/2=</9=:/1=~/ \/\///0/Dosa
//1/Cheese~2/Paneer~3/Sada~4/Schezwan~5/Onion~6/Chutney~7/Tomato~8/Jain~9/Masala~!/Mysore~@/Kerala~#/Pav Bhaji~$/Spring~%/Vegetable~*/Corn~^/Sweet *//&/Mushroom~|/Chilli~-/Uttappam~_/Mixed /,1,2,21,4,14,24,214,5,15,25,215,6016026021607.17.27.217.4.14.24.214.808:8>82:<1<2`<5<52<15`5<4<14<24`4<!<2!<1!`!`4!<@0@:2@021@0#0#:#>#1>$%0$2%0$1%0$21%0^0^:^>^2:^40^4>^4:^42:^&0^&>^&:^&2:&0&:&>&2:4&04&>4&:4*&2:2|02|:&|0&|:&|>&|2:3;3-:3->3-2:5;5-:5->5-2:9;9-:9->9-2:!;!-:!->!-2:_;_-:_->_-21Dosa

Try it online!

Not the most amazing compression but still.

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

PHP, 425 421 bytes

beating Python again. happy.

foreach([_10,_8,_2,"_Chutney ","_Tomato 2",_82,"Jain ",_3,_23,_83,_63,"_Kerala ","Pav Bhaji ","Spring _Vegetable ",7,78,75,5,85,"5X ",100,20,30,60,"Mixed 0"]as$i=>$t){[$a,$b]=explode(_,$t);echo strtr($a.($c=$b."9$a")."1${c}4$c".($i-12?41:14).$b.($i-10?$i-18?9:"98Corn 54194X 94X 19":9418639),["Uttappam ","Cheese ","Onion ","Masala ","Paneer ","Mushroom ","Mysore ","Sweet Corn ","Schezwan ","Dosa
","Sada ",X=>Chilli]);}

Run with -nr or try it online.

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

Ruby, 448 bytes

00000000  72 65 71 75 69 72 65 20  27 7a 6c 69 62 27 0a 70  |require 'zlib'.p|
00000010  75 74 73 20 5a 6c 69 62  3a 3a 49 6e 66 6c 61 74  |uts Zlib::Inflat|
00000020  65 2e 69 6e 66 6c 61 74  65 28 44 41 54 41 2e 72  |e.inflate(DATA.r|
00000030  65 61 64 29 0a 5f 5f 45  4e 44 5f 5f 0a 78 da 8d  |ead).__END__.x..|
00000040  55 cd 4e c3 30 0c be f3  14 7d 16 c6 09 34 81 54  |U.N.0....}...4.T|
00000050  e0 6e 98 b5 06 75 cd d4  76 1b e3 e9 11 5a 9a d9  |.n...u..v....Z..|
00000060  f1 e7 8c 5b fb fd 26 4e  95 b6 b4 a1 e6 21 4e 74  |...[..&N.....!Nt|
00000070  b7 ea 98 27 6e da 0c bc  d0 c0 3c 5a c0 08 db cf  |...'n.....<Z....|
00000080  8e 7f 4e 34 08 68 d1 58  66 49 75 19 df fa 3c 84  |..N4.h.XfIu...<.|
00000090  08 4a 4a 38 e5 38 b0 63  5a 75 87 79 e0 b3 0a 56  |.JJ8.8.cZu.y...V|
000000a0  58 b6 23 cc ca 5f e3 8e  e6 98 6a 64 a8 25 52 8a  |X.#.._....jd.%R.|
000000b0  4b b8 c6 3c 22 db 82 a8  72 f2 6e 13 52 3c 52 90  |K..<"...r.n.R<R.|
000000c0  4f 49 79 05 52 82 01 a4  70 4d 13 f5 fa ec 24 94  |OIy.R...pM....$.|
000000d0  1c 00 02 e2 cb d2 2c 02  42 d4 89 fb e9 96 cf 73  |......,.B......s|
000000e0  00 69 90 2b 27 ec 97 41  c9 fa 3c c5 11 cf c4 32  |.i.+'..A..<....2|
000000f0  cb 4c 5c cf 7f 05 d7 a5  58 e5 13 8f e5 b3 3c d0  |.L\.....X.....<.|
00000100  14 24 55 3a 5b 33 c7 e6  be a3 af 50 be ea c4 05  |.$U:[3.....P....|
00000110  95 1f 94 d1 4a b2 dd 8f  61 d8 36 ef bc e5 99 3e  |....J...a.6....>|
00000120  7a 56 68 12 62 32 85 55  9d 8e e6 c4 3c 37 ab 38  |zVh.b2.U....<7.8|
00000130  0e e6 5d ee 46 c0 6a c5  06 76 4c f9 68 5c c2 89  |..].F.j..vL.h\..|
00000140  cd fc ad e0 7a ff fa 30  75 63 8c 3b 9f 70 fa 33  |....z..0uc.;.p.3|
00000150  7f 2b 18 dd 12 aa 14 26  c1 fa 5a e6 f5 1b d7 3b  |.+.....&..Z....;|
00000160  32 b0 da 8f 61 61 e4 cd  0d 65 28 f4 7d 40 10 dc  |2...aa...e(.}@..|
00000170  9a 94 97 60 cd 00 47 a2  39 b5 8d bf 3f e0 db 3c  |...`..G.9...?..<|
00000180  d3 7e 4f 3b 04 f9 62 35  2b c4 48 eb e5 76 d5 45  |.~O;..b5+.H..v.E|
00000190  05 56 91 cb 2a 4c 81 ff  8c 2e 2b c1 9a 41 cd 10  |.V..*L....+..A..|
000001a0  73 ca 7e b9 38 8b be 02  ac 19 54 1f e6 94 3d 7c  |s.~.8.....T...=||
000001b0  f3 a6 ac d3 58 45 ae ca  20 25 cc bf fa c0 88 fb  |....XE.. %......|
\$\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.