37
\$\begingroup\$

Your task is to output the exact string

The Jabberwocky

without taking input. Normal rules for input and output apply, so both functions and programs are allowed.

Of course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabetic characters, must start the poem The Jabberwocky (case insensitive). To start the poem it must be a continuous substring of the poem starting at the beginning. The empty string is fine (although you probably won't score very well).

Here is the text for reference:

twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebewarethejabberwockmysonthejawsthatbitetheclawsthatcatchbewarethejubjubbirdandshunthefrumiousbandersnatchhetookhisvorpalswordinhandlongtimethemanxomefoehesoughtsorestedhebythetumtumtreeandstoodawhileinthoughtandasinuffishthoughthestoodthejabberwockwitheyesofflamecamewhifflingthroughthetulgeywoodandburbledasitcameonetwoonetwoandthroughandthroughthevorpalbladewentsnickersnackheleftitdeadandwithitsheadhewentgalumphingbackandhastthouslainthejabberwockcometomyarmsmybeamishboyofrabjousdaycalloohcallayhechortledinhisjoytwasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabe

Here is a program you can use to test this property.

If you run out of poem to use you may not use any additional alphabetic characters.

Alphabetic characters are characters a-z and A-Z here is the complete list:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Scoring

Your program will be scored in the number of non-alphabetic bytes used with fewer being better.

Here is a Haskell program that scores answers. (This assumes inputs are valid)

Example program

The following program would be valid:

twas&*brilliga77812nd Thesli thyt Oves didgy reand Gim bleinth ewab eal lmims ywe""""""""
ret h eb or o g o ve sa n dthemomerAthsoutgrabebewaretheJABBERWOCKmysonthe)(*)()((*98980908(()*(jawsthatbit

When stripped down to alphabetic characters it is:

twasbrilligandTheslithytOvesdidgyreandGimbleinthewabeallmimsyweretheb orogovesandthemomerAthsoutgrabebewaretheJABBERWOCKmysonthejawsthatbit

Which matches the first bit of the poem (case insensitive).

This program would score 59 because it contains these non-alphabetic characters:

&*77812           """"""""
          )(*)()((*98980908(()*(
\$\endgroup\$
  • 6
    \$\begingroup\$ What do you mean by "Start the poem"? \$\endgroup\$ – Pavel Mar 2 '18 at 20:53
  • 7
    \$\begingroup\$ This is trivial to do in languages without letters. \$\endgroup\$ – NoOneIsHere Mar 2 '18 at 21:02
  • 5
    \$\begingroup\$ The pedant in me feels obligated to remind you that the name of the poem is Jabberwocky (with no article), while the name of the beast is the Jabberwock (with no -y). Of course you can't change the required output now, but... \$\endgroup\$ – DLosc Mar 3 '18 at 4:55
  • 6
    \$\begingroup\$ Why so many votes to close as unclear? The "Here is a program you can use to test this property." part completely and unambiguously determines the valid criteria. \$\endgroup\$ – user202729 Mar 3 '18 at 8:44
  • 3
    \$\begingroup\$ @JonathanAllan Their being unable to understand the question doesn't necessary mean that the question is unclear... \$\endgroup\$ – user202729 Mar 3 '18 at 13:24

38 Answers 38

0
\$\begingroup\$

C# (Mono C# Shell), Score 12

//twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware
"The Jabberwock"//m
+"y"

Try it online!

Mono comes with a program called, well, csharp, that lets you run C# programs as a script. It's essentially a wrapper for the REPL, and supports implicit printing.

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

dc, score 14 12

#twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware
[The Jabberwock]#myso
n121#thejawsthatbitetheclawsthatcatchbewarethejubjubbirdandshunthefrumiousbandersnatchhetookhisvor
P

Try it online!

Rather uninteresting solution, but I'm not sure it can be optimized much more beyond uninteresting. Just comments everything out until the first part of the string, comments out until we hit an n to print, then inputs 121 as the ASCII value of 'y' and comments out until we hit a P to print.

-1 point thanks to Jo King (and no thanks to my inattention…)

-1 more point when I realized using the ASCII value for 'y' was ultimately shorter.

\$\endgroup\$
  • \$\begingroup\$ You don’t need the second half of the poem (and therefore one of the comments) if you’re not using it \$\endgroup\$ – Jo King Mar 5 '18 at 22:12
  • \$\begingroup\$ @JoKing Thanks, in my mind there was a scoring penalty for missing bits of poem — not sure where that came from. \$\endgroup\$ – brhfl Mar 6 '18 at 1:27
0
\$\begingroup\$

JavaScript (SpiderMonkey), score 12

twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware=>
"The Jabberwock"+//m
"y"

Try it online!

Credits

Shamelessly ripped from this answer for Java.

-2 points from Brian H.

\$\endgroup\$
  • 1
    \$\begingroup\$ get rid of the first comment and put it in the input variable name to save some chars. twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware=>"The Jabberwock"+//m "y". This saves two / and a newline. \$\endgroup\$ – Brian H. Mar 5 '18 at 16:00
0
\$\begingroup\$

APL (Dyalog Unicode), score 10

'twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware'⊢'The Jabberwock',⊢/'my'

Try it online!

'my' the character vector "my"

⊢/ rightmost element; "y"

'The Jabberwock', prepend the main part; "The Jabberwocky"

'twaare'⊢ yield that and discard the beginning of the poem

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

BF, 143 bytes (score 143)

-[--->+<]>-.[---->+++++<]>-.---.--[--->+<]>-.+++++[->++<]>.--[--->++++<]>+.+..+++.+++++++++++++.+++++.--------.------------.++++++++.[--->+<]>.

Try it online!

No letters means no poem.

Alternate (BF, 861 bytes, score 143)

twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebewarethejabberwockmysonthejawsthatbitetheclawsthatcatchbewarethejubjubbirdandshunthefrumiousbandersnatchhetookhisvorpalswordinhandlongtimethemanxomefoehesoughtsorestedhebythetumtumtreeandstoodawhileinthoughtandasinuffishthoughthestoodthejabberwockwitheyesofflamecamewhifflingthroughthetulgeywoodandburbledasitcameonetwoonetwoandthroughandthroughthevorpalbladewentsnickersnackheleftitdeadandwithitsheadhewentgalumphingbackandhastthouslainthejabberwockcometomyarmsmybeamishboyofrabjousdaycalloohcallayhechortledinhisjoytwasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabe-[--->+<]>-.[---->+++++<]>-.---.--[--->+<]>-.+++++[->++<]>.--[--->++++<]>+.+..+++.+++++++++++++.+++++.--------.------------.++++++++.[--->+<]>.

Now with 100% more poem

\$\endgroup\$
  • \$\begingroup\$ @cairdcoinheringaahing I don't think the rules are clear enough in order to determine if this is valid or not. \$\endgroup\$ – Pavel Mar 2 '18 at 21:05
  • 2
    \$\begingroup\$ @cairdcoinheringaahing it passes the test program (would you prefer I cut and paste the poem before the code? its just a no-op) \$\endgroup\$ – NoOneIsHere Mar 2 '18 at 21:06
  • 5
    \$\begingroup\$ I've also downvoted this answer. It is valid, as you pointed out but it chooses a language for which the challenge is as uninteresting as possible. (also your second submission has the same score as the first one) \$\endgroup\$ – Sriotchilism O'Zaic Mar 2 '18 at 21:10
  • 2
    \$\begingroup\$ It's also an extremely lazy answer, as you've just pasted the required text into a brainfuck text generator \$\endgroup\$ – Jo King Mar 3 '18 at 0:41
  • 1
    \$\begingroup\$ @WheatWizard Did you also downvote the 1k answers that are just a comment with the poem, a non-alphanumeric print function, "The Jabberwock" a comment with "m", and then printing "y"? \$\endgroup\$ – NoOneIsHere Mar 5 '18 at 2:24
0
\$\begingroup\$

PHP, score 12

<?=#twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebeware
"The Jabberwock".#m
y;

Try it online!

It's interesting that in the poem, it says "he chortled" which contains the word echo (ignoring the white space). I tried to use this to my advantage instead of having the <?=, but always came out with a higher score that way.

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

APL (Dyalog), score 21 14

1⌽1↓¯2⌽106↓'twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesandthemomerathsoutgrabebewareThe Jabberwockmy'

Try it online!

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

Befunge-93, 33 17 score

^twasbrilligandtheslithytovesdidgyreandgimbleinthewabeallmimsyweretheborogovesan
<dthemomerathsoutgrabebeware>:#,_@#:"The Jabberwock"m#"y"

Try it online!

Golfed 16 score thanks to the suggestion by W W

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