7
\$\begingroup\$

Given two integers, s and e, print the title of Black Mirror series #s episode #e.

Expected output is as below, case sensitive. Output for blank cells and invalid inputs is unspecified.

e↓s→                          1                  2                     3               4                              5
 1 | The National Anthem       | Be Right Back    | Nosedive            | USS Callister | Striking Vipers              |
 2 | Fifteen Million Merits    | White Bear       | Playtest            | Arkangel      | Smithereens                  |
 3 | The Entire History of You | The Waldo Moment | Shut Up and Dance   | Crocodile     | Rachel, Jack, and Ashley Too |
 4 |                           |                  | San Junipero        | Hang the DJ   |                              |
 5 |                           |                  | Men Against Fire    | Metalhead     |                              |
 6 |                           |                  | Hated in the Nation | Black Museum  |                              |

(The episode "White Christmas" is grouped with series 2 on Netflix, but originally aired as a standalone special, so it is not part of the challenge. The film Bandersnatch is likewise standalone and exempt.)

\$\endgroup\$
3
  • \$\begingroup\$ Can we make a function that returns the title instead of printing it? \$\endgroup\$ – Dion Jun 14 '20 at 5:58
  • \$\begingroup\$ @Dion As far as I know, returning rather than printing is always allowable. \$\endgroup\$ – Purple P Jun 14 '20 at 6:19
  • \$\begingroup\$ @Dion Returning is just printing to the function output. \$\endgroup\$ – David Callanan Jul 5 '20 at 8:18
5
\$\begingroup\$

Husk, 162 bytes

!x'x!¶¨Σṅ←ÿ‼⌋xżFE«Ȯ⌊Żψ'xΣẏ>ï?₀fẏu₈eṙ‼ḂkxẇïBȦrxΣ«QẆḟṁŸ)⁶ıex₉?²tx«‼UÜUÄd□Δ'xS▲⌋ȷ9oxṀËäαγFxHȦ∂↕εṄ|≠USSχ⁷ıżxŻKȦ£Ġx£%Øx□´'ËDJxẎȦlḊh₈Ċż_ṀÿKi▼V₉→xSmi►&η$x£ƒ´,⌋ȷ@,Ädÿ¿◄θ⁰

Try it online!

A perfect task for Husk's string compression. Seasons are separated with newlines and episodes are separated with 'x'. Then:

!x'x!¶¨...
      ¨...     Big compressed string
     ¶         Split on newlines
    !          Take the line corresponding to given season
 x'x           Split on 'x'
!              Take the title of the given episode
\$\endgroup\$
4
\$\begingroup\$

05AB1E, 213 bytes

.•Ω?"Λ1äγÍθ}Æuмï∍βb6G¨—Wc“jép¡úórÑ9ǝ‘øδs@!иésb•#`”0á½Ú©ÿ0ŽÚÿ0Lj,—É, ÿͱ…«00
0€€ƒ³à¬ÿ0ßà‡ÈÝìs0€€îÆ„ª of€î00
0€ïƒ©‚ƒ0„¸Ÿâ0€€Ò´doœÂ00
«¢d in ÿï¹0ÄÃÿ0†•ÿ0À…€¾ ÿ–›0†ŽŠ€ÿ0…±†¤ŠÄ
ƒÏ—´0USS„Òÿ0Aÿ0Cÿ0ÂŒ ÿ DJ0îÊÿ”¶¡0δ¡IèIèðÚ

Try it online or verify all test cases.

Explanation:

.•Ω?"Λ1äγÍθ}Æuмï∍βb6G¨—Wc“jép¡úórÑ9ǝ‘øδs@!иésb•
            "# Push compressed string "head the rocodile rkangel ister ipero and test dive the hem and ereens ers"
 #           # Split it on spaces
  `          # Pop and push each string separated to the stack
”0á½Ú©ÿ0ŽÚÿ0Lj,—É, ÿͱ…«00
0€€ƒ³à¬ÿ0ßà‡ÈÝìs0€€îÆ„ª of€î00
0€ïƒ©‚ƒ0„¸Ÿâ0€€Ò´doœÂ00
«¢d in ÿï¹0ÄÃÿ0†•ÿ0À…€¾ ÿ–›0†ŽŠ€ÿ0…±†¤ŠÄ
ƒÏ—´0USS„Òÿ0Aÿ0Cÿ0ÂŒ ÿ DJ0îÊÿ”
             # Push dictionary string "0 Striking Vipÿ0 Smithÿ0 Rachel, Jack, ÿ Ashley Too00\n
             # 0 The National Antÿ0 Fifteen Million Merits0 The Entire History of You00\n
             # 0 Be Right Back0 White Bear0 The Waldo Moment00\n
             #  Hated in ÿ Nation0 Noseÿ0 Playÿ0 Shut Up ÿ Dance0 San Junÿ0 Men Against Fire\n
             #  Black Museum0USS Callÿ0Aÿ0Cÿ0 Hang ÿ DJ0 Metalÿ",
             # with all `ÿ` automatically filled with the strings on the stack
 ¶¡          # Split it on newlines
   0δ¡       # Split each line on 0s
             #  [[""," Striking Vipers"," Smithereens"," Rachel, Jack, and Ashley Too","",""],
             #   [""," The National Anthem"," Fifteen Million Merits"," The Entire History of You","",""],
             #   [""," Be Right Back"," White Bear"," The Waldo Moment","",""],
             #   [" Hated in the Nation"," Nosedive"," Playtest"," Shut Up and Dance"," San Junipero"," Men Against Fire"],
             #   [" Black Museum","USS Callister","Arkangel","Crocodile"," Hang the DJ"," Metalhead"]]
      Iè     # Index the first input-integer into it (0-based and with wraparound)
        Iè   # Index the second input-integer into that list (0-based and with wraparound)
          ðÛ # Remove any leading spaces
             # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to use the dictionary? and How to compress strings not part of the dictionary?) to understand how the used compressed and dictionary strings work.

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

Stax, 202 bytes

ü○b(╠◘qÅñÿ[%Uδö╬ε#êc∙╪≈ü╒┘ú┴tÆ↔nU¥┴♣ߪ•┼<\╣`vΘ╒°²~♦∙'E♂○N½←àp▄û'XpéIê┼z♂Qìa~Æq7-T⌐ ○¡B▬#√╤cçµM╖Æ♦N╜Ü◄4òτ`≈úG{╧►)┴╬║º,Φ┤╫ÿα►]Q╬≈♠ [εjy0z▲dΘÜ╚é6♥#ö»ë'KC▬.W◙)lH↓√↓ö¿▐▌φ┬;┼ΣuΓuΣiè‼x╘ö╝▐┴ßIG•∙¿╦↓AQt}yd◘$éⁿ≤←

Run and debug it

This program takes episode and season as input, separated by a space.

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

Vyxal, 192 bytes

`λƛ ¬ε Ṫṅ¥ṗXṠ↳ ÷⁋ Ṗ≈sXλƛ ∆ɾ ∧Ġ of λß
Be ¬ẏ λǑX∧… ∞↑Xλƛ W…±o ɽ⁋
₁ḣ¦ḭX∨±∨ḊXż≬ Up λ¬ ↔÷X⟑ɖ ∨Ǐ °↔X←Ġd in λλ ⌐±
USS ⟑«iḊꜝrXArk›ǎXC≥ẋo∩ȧeX⟩ẇ λλ DJX∆↑÷≠X¬⁼ ¢⁋
Ẇ± Ŀʀ□ẊX€∧□Ṅ↳¾X₄ð, ¢…, λ¬ §⋏ ⟑⋏`↵\X/?i?i

Try it Online!

`...`         # Dictionary-compressed string 
     ↵        # Split on newlines
      \X/     # Split on Xs (vectorised)
         ?i?i # Index input twice
\$\endgroup\$
2
\$\begingroup\$

Charcoal, 224 bytes

§⪪§⪪”}∨⊙α⁷ξ{⪪\`G↔Iλ?I⟧∧≕EαγR≔³E↙\`UκêΣJ4⧴U↙�~B⁺^dF]η8A⊖ξ≡W¦¶⧴hNνX^#Ol▶⊙|Q|,/(:ZNQξζG↥≧⟲ψ∨]⮌⊖≦#Rς+vQlK≧⦄⁴φC7“L¡⊘[⁸⮌!⌕↗Op;⧴‹Hr,◧⁹‖·›↨χ➙⌕↙bM″G@ⅉ<↔GnQS§‖⎚Þ⟧⊗¤E*ⅈ⁶℅Orν%F¤×Xbη&◨χJWCXz�Π8D>νB⁶≔X″~↖≡@/ÀY#¦▷I¿↷Φ№!|↔δMKUλÀE§χUo:γ@▷”¶N⸿N

Try it online! Link is to verbose version of code. Explanation:

    ”...”       Compressed table of episode titles
   ⪪     ¶      Split on `\n`s
  §       N     Cyclically index by series
 ⪪         ⸿    Split on `\r`s
§           N   Cyclically index by episode
                Implicitly print

Because Charcoal uses cyclic 0-indexing the last series and last episode of each series will wrap around to 0 so they actually appear first in the table.

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

JavaScript, 353 bytes

s=>e=>`The National Anthem|Fifteen Million Merits|The Entire History of You||||Be Right Back|White Bear|The Waldo Moment||||Nosedive|Playtest|Shut Up and Dance|San Junipero|Men Against Fire|Hated in the Nation|USS Callister|Arkangel|Crocodile|Hang the DJ|Metalhead|Black Museum|Striking Vipers|Smithereens|Rachel, Jack, and Ashley Too`.split`|`[s*6+e-7]

Try it online!

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

Python 3, 360 bytes

lambda s,e:"The National Anthem|Fifteen Million Merits|The Entire History of You||||Be Right Back|White Bear|The Waldo Moment||||Nosedive|Playtest|Shut Up and Dance|San Junipero|Men Against Fire|Hated in the Nation|USS Callister|Arkangel|Crocodile|Hang the DJ|Metalhead|Black Museum|Striking Vipers|Smithereens|Rachel, Jack, and Ashley Too".split("|")[s*6+e-7]

Try it online!

\$\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.