Generate Lewis Caroll's Jabberwocky
The task is to generate the text of Lewis Caroll's Jabberwocky.
The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste from the linked Wikipedia article):
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!"
He took his vorpal sword in hand:
Long time the manxome foe he sought-
So rested he by the Tumtum tree,
And stood awhile in thought.
And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!
One, two! One, two! And through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.
"And hast thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callooh! Callay!"
He chortled in his joy.
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
The text above has to be produced verbatim, including newlines (you can use any of the common newline characters or character sequences, provided you stay consistent). Note that there is a newline character at the end of the last line.
This is code-golf, so the shortest entry per language wins.
Japt, 625 615 bytes ``` `' …
3y ago
Japt, 610 606 bytes Don't t …
3y ago
[Bubblegum], 769 bytes …
4y ago
[Python 3], 874 bytes …
3y ago
4 answers
Bubblegum, 769 bytes
074cd1dc7fb6baed2f568915ffeb6aa5c775264a9a6f77eb418f0793da59b234599dadb6804269dbb5a213a05c807b0723f79512c284f46e8dbb6b0274f1b36606988b67ea58cf68beabe10f158702fcbf4c2b30d7b4f26190901aa713e125aee132d76940aff74588831a1908d8541c09f042556a7c7e24e80370734855cd398797d016c22627e54bec7c76034f141610fcbb8edb9ab6194c5914680b4c735f7a0e804b213dda7380469109d3a1296f04212cc5106e1282560971c3d4d357f330585209d924545a0e5180ccc1a01c8c65df7f29bb9fe3a5aeba8bf97781d60194f34bdfdbfc9aecfc49e8bd6896dc202d92830dd0ff31a115567bcec156ce21f705909b873eff8795764f24a6823f95b6c9548d2398cc1befecbf9298e3ec1211fea9615a9654746eb5defaafd70bd96ea6bff3d587ee01d7d631c5a613883afc25c7f9da67a7f185f19f3378d8790b173393344c2e66af508d63798be175f56178e5402ab07c8b97bc0c2c582010154a71c59acf175c4f2974b68cf319cace4de83e37d6d6f93b58f000033ed0accc7a742292780c5eb2fa87daa61a2e7794911787de40abed55f872483fa776e5d6158229577ec58b9a7b2e1f7c71930d8655491025808ceed9f960a4ecfcc69787bc965fc29852e77d6b6713b3e6d3b5e992d710a775464c9e3c7cc82d6bf7866f2b985e549a8b81dd5803f0746cd41dbe5f016d65f40f1efc4aa7ea204e73f9c47a9c2f9ce9b5d46b018c0bc2d68ae15635fa967be70cd7cc9d47a62da62e0546ae68a912cae2408e4c9b5dbeddb218cc3c70c69f11175cdc61c8a7422d50bb8038fcbd7d9dff05bdd821931c0e083a9f4f509b776106219099f616a8a439d12491bff97f31222881cbafe273680ae34d59ca5536f25c308e6402b31191d235bbfdcfa4bb681410c0d84c0f1f4d008b591ddc7d3d2c32c9da15554d51a6355686eb9afe64c45f96a5f83dbae78545b9daf1118e600878eadec76d3a26cee9ed3e817b4be1d7e95380ab13c6d2a32cea2370208925c736e41288a04658380d6e86cb07ed7b08e2c8efa76234fb18e3b25e00 .
Japt, 625 615 bytes
`'T°s ߦg, d e sÒy v
Did gy d g½e e °¼;
A¥ Úßy ØÀ e Þgov,
A e Ú ÎÈs tg¼.
`
+i`
"BeØ e {=`Jab¼rwock`}, my s!
T jaws È ßÒ, e claws È ¯t®!
BeØ e Jubjub bird, d д
T èã BÂrsn
®!"
He ok s vpal sÙ Ê@:
Lg ÈØ e µnxo´ foe Ñht-
So Î by e Tumtum É,
A ÐOd aØe Èght.
A uffh Èght ÐOd,
T {U}, ØP ey fla´,
Ca´ ²iffÒ È*ugh e tªgey wood,
A ¿rÞB ¯´!
O, two! O, two! A È*ugh d È*ugh
T vpal Þue ØË sÍõ-snack!
He ¤ft Ü%, d ØP s Ê%
He ØË galumpÊ back.
"A ÊQ È sÓ° e {U}?
Co´ my ms, my ¼aÚÊ ¾y!
O fbjs »y! CÃ
oh! CÃy!"
He Öt¤d s joy.
-10 bytes thanks to @Shaggy
Dictionary compression, repeating the first paragraph. I can't really find any patterns to do anything else... words such as "Jabberwock" (which aren't in the dictionary) aren't compressed enough to try and save on, I think.
1 comment thread
Japt, 610 606 bytes
Don't think there's anything more that can be done with it than this.
933î`'T°s ߦg, d e sÒy v
Did gy d g½e e °¼;
A¥ Úßy ØÀ e Þgov,
A e Ú ÎÈs tg¼.0"BeØ e 1, my s!
T jaws È ßÒ, e claws È ¯t®!
BeØ e Jubjub bird, d д
T èã BÂrsn
®!"0He ok s vpal sÙ Ê@:
Lg ÈØ e µnxo´ foe Ñht-
So Î by e Tumtum É,
A ÐOd aØe Èght.0A uffh Èght ÐOd,
T 1, ØP ey fla´,
Ca´ ²iffÒ È*ugh e tªgey wood,
A ¿rÞB ¯´!0{`O, two! `²}A{22î` È*ugh a`}
T vpal Þue ØË sÍõ-snack!
He ¤ft Ü%, d ØP s Ê%
He ØË galumpÊ back.0"A ÊQ È sÓ° e 1?
Co´ my ms, my ¼aÚÊ ¾y!
O fbjs »y! CaÒoh! CÃy!"
He Öt¤d s joy.0`r0R² r1`Jab¼rwock
- Everything between the backtick on the first line and the first backtick on the last line is the compressed poem with a few byte saving tricks:
- The last stanza is omitted,
- The double newlines are replaced with
0
s, and, - The 3 occurrences of "Jabberwock" are replaced with
1
s.
- In addition to that there's some string interpolation on the 13th line, enclosed by the
{}
s:- The first one contains the compressed string "One, two!" between the backticks which the
²
duplicates, and, - The second one contains the compressed string "nd through a" which the
22î
repeats to length 22.
- The first one contains the compressed string "One, two!" between the backticks which the
- Then, at the end of that, we use
r
to replace the0
s withR
(Japt's newline constant) duplicated and the1
s with the compressed string "Jabberwock". - Finally, the
933î
at the very beginning repeats the final result to length 933.
0 comment threads
Python 3, 874 bytes
a="'Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe;\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.";b="he Jabberwock";c="Beware t";d="One, two!";e="nd through";f="\n\n";g="vorpal"
print(a+"\n\n\""+c+b+", my son!\nThe jaws that bite, the claws that catch!\n"+c+"he Jubjub bird, and shun\nThe frumious Bandersnatch!\"\n\nHe took his",g,"sword in hand:\nLong time the manxome foe he sought-\nSo rested he by the Tumtum tree,\nAnd stood awhile in thought.\n\nAnd as in uffish thought he stood,\nT"+b+", with eyes of flame,\nCame whiffling through the tulgey wood,\nAnd burbled as it came!"+f+d,d,"A"+e,"a"+e+"\nThe+",g,"blade went snicker-snack!\nHe left it dead, and with its head\nHe went galumphing back.\n\n\"And hast thou slain t"+b+"?\nCome to my arms, my beamish boy!\nO frabjous day! Callooh! Callay!\"\nHe chortled in his joy.\n\n"+a)
This was way faster to deal with than "99 Bottles of Beer" to be completely honest.
0 comment threads