-4
\$\begingroup\$

I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something.

The Challenge

This challenge is intended to amuse those of every skill level and users of every language. Your task, in itself, is very simple. Write a program (or function) that prints the longest sentence in 140 bytes.

The Input

Your code should not receive input from anywhere. You may not take any arguments, any values from STDIN, or any word lists. Additionally, built-ins or libraries that generate word lists or manipulate word lists are also banned. Output should be generated by the program itself.

The Output

Your output should abide by the following rules:

  • For simplicity, the output must be in English, and must not contain any characters other than a-z A-Z .,:;()!?-. (Tabs and newlines should not be present in your sentence, and exactly one space should exist between words)
  • Your output may include trailing or leading whitespace, but these do not count toward your final score.
  • Your output must be a singular, valid, punctuated, grammatically correct sentence.
  • As long as the sentence is syntactically valid, meaning is unimportant. Please refrain from vulgarity.
  • Your output should only include words recognized by dictionary.com.
  • Your output must not repeat any singular word more than 3 times. Conjunctions and articles are an exception to this rule and may be repeated any number of times.
  • Your output must be finite.
  • Any output method is acceptable--whether it be to STDOUT, a file, a returned string, whatever.

The Rules

  • Your score is the length, in bytes, of the sentence your program generates.
  • Program source code should not exceed 140 bytes. Insert witty comment about how my only method of communication is Twitter here.
  • Your program should terminate within a minute on any modern machine.
  • Sufficiently clever code or valid output larger than the code itself may be eligible for a bounty!
  • Standard loopholes apply.

Questions, comments, concerns? Let me know!

\$\endgroup\$
14
  • 1
    \$\begingroup\$ Do I have to print just 1 sentence ? \$\endgroup\$
    – Optimizer
    Mar 27, 2015 at 17:07
  • 2
    \$\begingroup\$ The problem is that sentences like 1 and 2 and 3 and 4 and 5 and ... and 999 are all numbers. would be valid and could be infinitely long. \$\endgroup\$ Mar 27, 2015 at 17:13
  • 1
    \$\begingroup\$ @Calvin'sHobbies Ahhhhh... Dang it. Outlawing numbers... \$\endgroup\$
    – BrainSteel
    Mar 27, 2015 at 17:20
  • 2
    \$\begingroup\$ You should post a new challenge in the sandbox on the meta site first. We wouldn't have to ask so many questions here, that way. \$\endgroup\$
    – mbomb007
    Mar 27, 2015 at 21:55
  • 1
    \$\begingroup\$ What is your reference for checking whether something is a "grammatically correct sentence"? When you say that no word may be repeated more than thrice, does that mean consecutively (to eliminate things like Fred, where Jim had had "had", had had "had had"; ...) or does that count all occurrences in the sentence? \$\endgroup\$ Mar 27, 2015 at 23:29

5 Answers 5

5
\$\begingroup\$

CJam, 140 bytes → 2301 characters

Try it online.

Code

"I'm ""jdÇÉÛ7ª%ùÞtÛù    ±çV(exç3å$Z±³RÌÊ
D»l°ØEøv¸x¡·ðQà\+ܵjR¡2>ãq§Sã¾iPLÛ"252b27b'`f+'`/2/{~"ing, "+f+~}/"and "\7<]]3*" while "*'.

Output

I'm bagging, fagging, gagging, lagging, nagging, ragging, sagging, tagging, wagging, bailing, failing, hailing, jailing, mailing, nailing, railing, sailing, tailing, wailing, capping, lapping, mapping, napping, rapping, sapping, tapping, yapping, zapping, bearing, fearing, gearing, hearing, nearing, rearing, searing, tearing, wearing, bending, fending, lending, mending, pending, rending, sending, tending, vending, wending, betting, getting, jetting, letting, netting, petting, setting, vetting, wetting, dipping, hipping, kipping, nipping, pipping, ripping, sipping, tipping, yipping, zipping, bobbing, dobbing, fobbing, gobbing, jobbing, lobbing, mobbing, robbing, sobbing, bulling, culling, dulling, fulling, gulling, hulling, lulling, mulling, and pulling while I'm bagging, fagging, gagging, lagging, nagging, ragging, sagging, tagging, wagging, bailing, failing, hailing, jailing, mailing, nailing, railing, sailing, tailing, wailing, capping, lapping, mapping, napping, rapping, sapping, tapping, yapping, zapping, bearing, fearing, gearing, hearing, nearing, rearing, searing, tearing, wearing, bending, fending, lending, mending, pending, rending, sending, tending, vending, wending, betting, getting, jetting, letting, netting, petting, setting, vetting, wetting, dipping, hipping, kipping, nipping, pipping, ripping, sipping, tipping, yipping, zipping, bobbing, dobbing, fobbing, gobbing, jobbing, lobbing, mobbing, robbing, sobbing, bulling, culling, dulling, fulling, gulling, hulling, lulling, mulling, and pulling while I'm bagging, fagging, gagging, lagging, nagging, ragging, sagging, tagging, wagging, bailing, failing, hailing, jailing, mailing, nailing, railing, sailing, tailing, wailing, capping, lapping, mapping, napping, rapping, sapping, tapping, yapping, zapping, bearing, fearing, gearing, hearing, nearing, rearing, searing, tearing, wearing, bending, fending, lending, mending, pending, rending, sending, tending, vending, wending, betting, getting, jetting, letting, netting, petting, setting, vetting, wetting, dipping, hipping, kipping, nipping, pipping, ripping, sipping, tipping, yipping, zipping, bobbing, dobbing, fobbing, gobbing, jobbing, lobbing, mobbing, robbing, sobbing, bulling, culling, dulling, fulling, gulling, hulling, lulling, mulling, and pulling.

Explanation

As I'm sure you can tell, my main tactic was to generate a large number of very similar words. My plan was to find groups of words that all had the same spelling after the first letter with a large number of possible first letters, as these could be heavily compressed. To find the best candidates, I grabbed the whole dictionary, grouped words by their spelling after the first letter, and sorted these groups in descending order by the sum of the lengths of all words in the group.

Upon doing this, I discovered that many of the top entries were the present tense of verbs, in the form "___ing." This was great, because it meant that not only could I abstract the "ing" out of every group, but also every word could simply be thrown in a big list in the sentence because they were all of a form of speech that allowed it. The big mess of characters in the middle of the code encodes as much of this data as I could fit, using multiple compression methods.

As for the sentence structure generated, it's fairly simple. It's certainly a bit redundant, repeating the main phrase 3 times for maximal length, but I believe it's grammatically correct. With the innards of the verb lists cut out, the sentence looks like this:

I'm bagging, ... , and pulling while I'm bagging, ... and pulling while I'm bagging, ... and pulling.
\$\endgroup\$
3
\$\begingroup\$

Python - Code: 140, Output: 476

NOTE: Currently needs to be modified. Any help on replacing a couple words within the byte limit?

I made use of the built-in documentation for the integer type, and so far I am confident that this is one of the most unique, if not the most creative, approach(es).

Most of the code was overhead used to remove newlines and combine the documentation into a single sentence. Annoyingly, I also had to replace a couple of occurrences of the word "string".

import re;print'Cattle, c'+re.sub('a string','a key',re.sub('  ',', but ',re.sub(r'\. ',', and',re.sub(r'\n',' ',int.__doc__.lower()))[28:]))

Output:

Cattle, convert a key or number to an integer, if possible, and a floating point argument will be truncated towards zero (this does not include a key representation of a floating point number!), but when converting a key, use the optional base, and it is an error to supply a base when converting a non-string, and if base is zero, the proper base is guessed based on the string content, and if the argument is outside the integer range a long object will be returned instead.

Run it here: http://repl.it/fsM

\$\endgroup\$
7
  • \$\begingroup\$ This is really cool. However, the words "base" and "is" both appear four times, so it needs some tweaking. \$\endgroup\$
    – Runer112
    Mar 27, 2015 at 22:36
  • \$\begingroup\$ Ah, my bad. I don't know if I can fix that with fewer than 140 bytes... \$\endgroup\$
    – mbomb007
    Mar 27, 2015 at 22:41
  • \$\begingroup\$ Would this be considered against Output should be generated by the program itself.? Just curious. \$\endgroup\$
    – tfitzger
    Mar 28, 2015 at 0:37
  • \$\begingroup\$ @tfizger I don't think there's anything wrong since it's built-in, and I certainly had to modify it to generate this single sentence. \$\endgroup\$
    – mbomb007
    Mar 29, 2015 at 0:46
  • \$\begingroup\$ @Runer112, The question is unclear to me whether is means it cannot "contain" the same word that many times, or if it cannot "repeat" it, which is what it says. My program uses it in a different context each time, with a different verb, so idk. \$\endgroup\$
    – mbomb007
    Mar 30, 2015 at 20:40
1
\$\begingroup\$

JAVA - Code: 122, length: 153 words, 464 bytes

Java, yep, java. Ok, so I had to make it a function instead of a program. The boilerplate was just too much.

Golfed code:

void p(){int i=0;char c=1;while(i++<3){for(c=65;c<90;System.out.print(c+++" and "));}System.out.print(c+" are letters.");}

Readable version:

void p(){
    int i=0;
    char c=1;
    while(i++<3){
        for(c=65;c<90;System.out.print(c+++" and "));
    }
    System.out.print(c+" are letters.");
}

Output: A and B and C and D and E and F and G and H and I and J and K and L and M and N and O and P and Q and R and S and T and U and V and W and X and Y and A and B and C and D and E and F and G and H and I and J and K and L and M and N and O and P and Q and R and S and T and U and V and W and X and Y and A and B and C and D and E and F and G and H and I and J and K and L and M and N and O and P and Q and R and S and T and U and V and W and X and Y and Z are letters.

Each letter is defined under dictionary.com as a valid word in response to its ordinal position in the alphabet. Each word is used at most three times.

\$\endgroup\$
1
  • \$\begingroup\$ Whoops, grabbed the wrong code for the One issue. Also, I must have missed that requirement. Back to the drawing board! \$\endgroup\$
    – tfitzger
    Mar 27, 2015 at 21:16
-1
\$\begingroup\$

Haskell, code: around 104 bytes, output: as many as your computer can produce within the 1min limit

f = let n=4 in putStr $ "Corollary: "++ (replicate n '(') ++ "a-b" ++ (replicate n ')') ++ " equals c."

Output example:

Corollary: ((((a-b)))) equals c.

Of course you can change n to any number you want (including expressions like 100^100 to stay within the 140 byte limit) to increase the number of parentheses.

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

Excel (because ... :) ): Code: 135 Output: 211

[edit] corrected beginning of sentence, the previous one really wasn't correct, this version is slightly better. Still a bit of a grammar "hack", but still valid by the rules in any case :) [/edit]

=CONCATENATE("Where ",REPT("someone thinks that ",3),rept("everyone understands when ",3),rept("they believe what ",3),"nobody cares.")

Output:

Where someone thinks that someone thinks that someone thinks that everyone understands when everyone understands when everyone understands when they believe what they believe what they believe what nobody cares.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.