64
\$\begingroup\$

Introduction

Bad news guys - you got detention. Your English teacher doesn't understand this site and wants you to "stop doing math on your digital dohickeys, this is English class!"

She sentenced you to write her favorite saying on the blackboard 25 times, which will give a total of 100 lines on the blackboard.

The eighteen-hundreds were a time for rum.
The nineteen-hundreds were a time for fun.
The two-thousands are a time to run
a civilized classroom.

Lucky for you, you are an avid reader (not to mention an expert code-golfer)! You have a read about a trick that might possibly get you off easy.

foxtrot

(Foxtrot by Bill Amend)

Unfortunately for Jason, it didn't work out. But you have a better idea! Since your English teacher thinks you're doing math, if you leave all the numbers out of your program it just might work! You also want to keep your program as short as possible because you are a lazy student and don't want to write a lot on the board.

Write a program that complies with the following rules:

  • Your program must print the 4 above lines 25 times. The lines must be outputted in that order, repeating. Total exactly 100 lines of output (a trailing newline at the very end or a leading newline at the very beginning is okay).
  • You cannot use the characters 0123456789. Your teacher gets confused by math and will call you out!
  • You can use any imports and external libraries without counting the imports. Your English teacher doesn't know about programming. Jason could have saved a lot of work by not writing #include <stdio.h> and you don't want to make his same mistakes!
  • Score your program by byte count. Lowest score wins!
\$\endgroup\$
9
  • 2
    \$\begingroup\$ If the text would've read "1900s", writing the output would've been slightly more tricky. \$\endgroup\$
    – Ingo Bürk
    Commented Oct 23, 2014 at 14:50
  • 30
    \$\begingroup\$ to the comix: he's not printing \n's, and the loop from 1 is pretty awkward (like against C nature)... \$\endgroup\$
    – V-X
    Commented Oct 23, 2014 at 15:41
  • 12
    \$\begingroup\$ @V-X Bill Amend is a long-time Pascal die-hard, and whenever he writes C that becomes pretty apparent. \$\endgroup\$
    – fluffy
    Commented Oct 23, 2014 at 18:09
  • 5
    \$\begingroup\$ This sounds very much like one of my old English teachers. \$\endgroup\$
    – Kaz Wolfe
    Commented Oct 25, 2014 at 16:58
  • 2
    \$\begingroup\$ Banning + would have made sense here, but maybe that would have been too difficult. \$\endgroup\$
    – Pharap
    Commented Oct 28, 2014 at 9:38

63 Answers 63

2
\$\begingroup\$

Rant, 191 bytes

Not the shortest solution, but still cool. I wrote a subroutine to write the first three lines, and designed it so calling it with an empty argument returned a string 25 characters long. I then pass its length to the repeater.

[pin:][$[_:a]:The [arg:a][sync:;ordered]{thousands a|teen-hundreds we}re a time ][r:[len:[$_:]]]{[step:][$_:eigh]for rum.\N[$_:nine]for fun.\N[step:][$_:two-]to run\Na civilized classroom.\N}

Ungolfed:

[pin:]
[$[_:a]:The [arg:a][sync:;ordered]{thousands a|teen-hundreds we}re a time ]
[r:[len:[$_:]]]
{
    [step:]
    [$_:eigh]for rum.\N
    [$_:nine]for fun.\N
    [step:]
    [$_:two-]to run\N
    a civilized classroom.\N
}

Try it online

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

Perl, 140 139

improving on chilemagic answer. feature say for 3 bytes, text redundancy for 3 bytes.

$r="re a time";$s="teen-hundreds we$r for";say"The eigh$s rum.
The nine$s fun.
The two-thousands a$r to run
a civilized classroom."for b..z
\$\endgroup\$
2
  • \$\begingroup\$ You can move the r into $e as well to save another byte. \$\endgroup\$
    – hmatt1
    Commented Oct 24, 2014 at 22:08
  • \$\begingroup\$ @chilemagic duh, thanks! missed that somehow. Under 140 now! \$\endgroup\$ Commented Oct 24, 2014 at 22:44
2
\$\begingroup\$

GML (Game Maker Language), 169

a="teen-hundreds were a time for "b="The eigh"+a+"rum#The nine"+a+'fun#The two-thousands are a time to run#a civilized classroom#"c=b+b+b+b+b;d=c+c+c+c+c;show_message(d)
\$\endgroup\$
0
2
\$\begingroup\$

LATEX 239 226

The byte count does not include the \documentclass command nor any \usepackage commands. I would argue both count as using external packages, as the former includes definitions in an external .cls file, and usepackage is practically synonymous with an include statement. Output is a pdf file containing the 100 lines with no other text, formatted appropriately. Try it at writelatex.com!

\begin{document}\newcounter=\def\_{re a time }\def\-{een-hundreds we\_}\StrLen\-[\b]\forloop=\parindent{\value=<\b}{The eight\-for rum.\\The ninet\-for fun.\\The two-thousands a\_to run\\a civilized classroom.\\}\end{document}

Ungolfed:

\documentclass{letter}

\usepackage{forloop}
\usepackage{parskip}
\usepackage{xstring}
\usepackage{nopageno}

\begin{document}

\newcounter=

\def\_{re a time }
\def\-{een-hundreds we\_}

\StrLen\-[\b]

\forloop=\parindent{\value=<\b}{

    The eight\-for rum.\\
    The ninet\-for fun.\\
    The two-thousands a\_to run\\
    a civilized classroom.\\

}

\end{document}

Edit: New and improved. Also made link go to read-only version of code. Thank you Dennis!

\$\endgroup\$
6
  • 1
    \$\begingroup\$ 1. You should link to the read-only version of your document. I accidentally modified it (but undid all changes). 2. You can save a few bytes by eliminating whitespace and curly brackets : \begin{document}\newcounter=\def\_{re a time }\def\-{een-hundreds we\_}\StrLen\-[\b]\forloop=\parindent{\value=<\b}{The eight\-for rum.\\The ninet\-for fun.\\The two-thousands a\_to run\\a civilized classroom.\\}\end{document} \$\endgroup\$
    – Dennis
    Commented Oct 26, 2014 at 14:18
  • \$\begingroup\$ Suggested changes made, thank you for the tips. \$\endgroup\$ Commented Oct 26, 2014 at 16:34
  • \$\begingroup\$ You're over-optimizing it. It would be much shorter if you did it like my plainTeX solution. :P \$\endgroup\$
    – user344
    Commented Oct 27, 2014 at 13:53
  • \$\begingroup\$ Interesting, thanks. Rather than modify my answer, I'm going to upvote yours! Cheers! \$\endgroup\$ Commented Oct 27, 2014 at 15:55
  • \$\begingroup\$ Looks like mine is currently invalid though, I overlooked the #1s. :/ \$\endgroup\$
    – user344
    Commented Oct 27, 2014 at 16:29
2
\$\begingroup\$

TeX - 169

\def\s{teen-hundreds were a time for }\def\p{The eigh\s rum.

nine\s fun.

The two-thousands are a time to run

a civilized classroom.

}\def\m{\p\p\p\p\p}\m\m\m\m\m\bye

Note that the blank lines are intentional and actually required for the output to be properly formatted.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It's fixed now. :) \$\endgroup\$
    – user344
    Commented Oct 27, 2014 at 18:12
2
\$\begingroup\$

Golfscript - 139 134

'TeighYrum.TnineYfun.Ttwo-thousands aRto run
a civilized classroom.''#
'{-}**'Y'/'teen-hundreds weRfor '*'T'/'
The '*'R'/'re a time '*

Teacher: Joshy * , are you hashtagging in class again? Two weeks detention! #howdoesthatfeel

* name preserved to protect idensity

EDIT: Found shorter code.

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

PHP - 157

$f='re a time';$r="teen-hundreds we$f for";echo str_repeat("The eigh$r rum.\nThe nine$r fun.\nThe two-thousands a$f to run\na civilized classroom.\n",aa^SU);
\$\endgroup\$
3
  • 5
    \$\begingroup\$ Use $s instead of $string to save on quite a few bytes. \$\endgroup\$
    – Zaenille
    Commented Oct 24, 2014 at 11:41
  • 1
    \$\begingroup\$ If you want to use str_repeat, use this: $f='re a time';$r="teen-hundreds we$f for";echo str_repeat("The eigh$r rum.\nThe nine$r fun.\nThe two-thousands a$f to run\na civilized classroom.\n",aa^SU); (hardcode the \n to save bytes.) and you have a 153 byte long answer! (aa^SU is 24, which is the same as (a^S)*10+(a^U) which is (2*10)+4) I based the divisions on my code. Please, present a bytecount next time and try to golf it further. \$\endgroup\$ Commented Oct 25, 2014 at 19:12
  • \$\begingroup\$ Please update the byte count when you update the answer. You can use mothereff.in/byte-counter, make sure there's no empty line at the end. Also, this can be golfed futher by removing the spaces around the = and the newline after classroom.";. \$\endgroup\$
    – user344
    Commented Oct 28, 2014 at 12:06
2
\$\begingroup\$

Perl - 152 146 bytes

$_="-hundreds were a time for";say"The eighteen$_ rum.\nThe nineteen$_ fun.\nThe two-thousands are a time to run\na civilized classroom.\n"x y///c

This makes use of perl's string repetition operator and exploits a substring of length 25.

Ungolfed version:

$_ = "-hundreds were a time for";
say "The eighteen$_ rum.\nThe nineteen$_ fun.\nThe two-thousands are a time to run\na civilized classroom.\n"x y///c
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Use $_ instead of $h and then you can use length or better yet y///c without the $h argument. You can put a space between the x and length and get rid of the parenthesis. Think perl -E'$_="test";say"t"x y///c' \$\endgroup\$
    – hmatt1
    Commented Oct 23, 2014 at 20:43
  • \$\begingroup\$ @chilemagic Thanks, that saved 5 bytes and removing trailing semicolon saved one more. \$\endgroup\$
    – Gowtham
    Commented Oct 31, 2014 at 18:13
2
\$\begingroup\$

Common Lisp (165 bytes)

(format t"~v{~{The ~(~A~)~#[~;-thousands are~:;teen-hundreds were~] a time ~A
~}~:*~}"(+ #xA #xF)'((eigh"for rum."nine"for fun."two"to run
a civilized classroom.")))

Explanations

  • 25 equals to 10 + 15, which is equivalent to A + F in base 16. Hence (+ #xA #xF).
  • 25 is passed to the ~v{ ... ~} constructs, which iterates over arguments at most v times, where v is given as an argument of format
  • ~:* rewinds current argument to the previous element in the argument list; inside the ~{...~} constructs, that practically means infinite loop. However, this infinite loop is bounded by ~v, ie. 25.
  • ~#[<zero>~;<one>~;:<else>~] is a switch, based on the value of the remaining number of arguments in the list (due to the # modifier).
  • ~(...~) downcases the contained text

Note: I could have used fewer characters by using ~R on 18, 19 and 2 (and using a litteral 25) but this is forbidden.

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

Brainfuck, 659 bytes

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

Try it online!

I found this using my own mediocre Brainfuck cruncher.

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

EXCEL, 168 Bytes

Decided to add this for fun. Instead of using the length() I decided to use character codes... If SUBSTITUTE wasn't such a long command, I could have joined in on the string compression too. I am drooling over C# which can use: 'Z'%'A'

Similar to the other Excel, but not using any row / column references.

Decided to add this for fun. Instead of using the length() I decided to use character codes... If SUBSTITUTE wasn't such a long function I could have joined in on the string compression too.

Similar to the other Excel, but not using any row / column references.

=REPT("The eighteen-hundreds were a time for rum. 
The nineteen-hundreds were a time for fun. 
The two-thousands are a time to
run a civilized classroom. ",ARABIC("XXV"))
\$\endgroup\$
6
  • \$\begingroup\$ excluding new line, I counted it 179. XD. let's wait for the others what should be the correct count byte. Also you can less some bytes if you use subtraction instead of Mod. Also, need to add new line at the end of the sentence \$\endgroup\$
    – remoel
    Commented Apr 16, 2019 at 8:52
  • 2
    \$\begingroup\$ ARABIC("XXV") is even shorter than CODE("Z")-CODE("A"). \$\endgroup\$
    – orthoplex
    Commented Apr 16, 2019 at 9:06
  • \$\begingroup\$ @remoel - Yes I considered the subtraction, but I liked that there was nothing "Mathy" looking (+ or -) in the formulas. orthoplex - nice, that also meets my other criteria! \$\endgroup\$
    – Origin
    Commented Apr 16, 2019 at 9:11
  • \$\begingroup\$ Line endings are almost universally counted without carriage return on here. TIO would be correct in that case. \$\endgroup\$
    – orthoplex
    Commented Apr 16, 2019 at 9:23
  • \$\begingroup\$ @Origin 1. run is on the wrong line. 2. you no longer use char codes so you need to update the explanation \$\endgroup\$
    – ASCII-only
    Commented Apr 16, 2019 at 12:06
2
\$\begingroup\$

Vyxal, 95 bytes

`λƛ e⋏ṫ⟑⌈-←¾ λ□ a λṙ λ⟑ ≥⁋.
λƛ ∵‹⟑⌈-←¾ λ□ a λṙ λ⟑ ×ė.
λƛ ƛ»-ʁḢ λ½ a λṙ to ÷Ḣ
a ↔Ŀized τ⟇.
`₁½½*

Try it Online!

`...`     # Dictionary compressed string
     ₁½½  # 100 / 2 / 2 = 25
        * # That many times
\$\endgroup\$
1
\$\begingroup\$

C# (193)(189)

(Executable in LINQPad)

Golfed:

void Main(){for(int i='!';i++<':';)"The eighteen-hundreds were a time for rum.\nThe nineteen-hundreds were a time for fun.\nThe two-thousands are a time to run\na civilized classroom.".Dump();}

Ungolfed:

void Main()
{
    for(int i='!';i++<':';)
        "The eighteen-hundreds were a time for rum.\nThe nineteen-hundreds were a time for fun.\nThe two-thousands are a time to run\na civilized classroom.".Dump();
}

After update:

void Main(){var x="teen-hundreds were a time for ";for(int i='!';i++<':';)"The eigh_rum.\nThe nine_fun.\nThe two-thousands are a time to run\na civilized classroom.".Replace("_",x).Dump();}

Ungolfed:

void Main()
{
    var x="teen-hundreds were a time for ";

    for(int i='!';i++<':';)
        "The eigh_rum.\nThe nine_fun.\nThe two-thousands are a time to run\na civilized classroom.".Replace("_",x).Dump();}
\$\endgroup\$
1
\$\begingroup\$

Java 247 229 225

Not counting package and import statements

class A{public static void main(String[] a){String s="teen-hundreds were a time for "; for(int i='a';i++<'z';)out.print("The eigh"+s+"rum.\nThe nine"+s+"fun.\nThe two-thousands are a time to run\na civilized classroom.\n");}}

Ungolfed

    package a;
    import static java.lang.System.*;
    class A{
        public static void main(String[] a){
            String s="teen-hundreds were a time for "; 
            for(int i='a';i++<'z';)
            out.print("The eigh"+s+"rum.\nThe nine"+s+"fun.\nThe two-thousands are a time to run\na civilized classroom.\n");
        }
    }
\$\endgroup\$
0
1
\$\begingroup\$

Delphi (229 227 224/238)

Not great but still fun.
Repeats for each char in set ['B'..'Z'].

This is a procedure so use clauses aren't included. You will need the unit IdGlobal for this to work. Including the unit it will be 238.

procedure W;var C:Char;begin for C in['B'..'Z']do writeln(StringsReplace('%eigh^+for rum.*%nine^+for fun.*%two-thousands are+to run*a civilized classroom.',['%','^','*','+'],['The ','teen-hundreds were',^J,' a time ']));end;

Ungolfed

procedure W;
var C:Char;
begin
  for C in['B'..'Z']do
    writeln(StringsReplace('%eigh^+for rum.*%nine^+for fun.*%two-thousands are+to run*a civilized classroom.',['%','^','*','+'],['The ','teen-hundreds were',^J,' a time ']));
end;

Replace broken up

StringsReplace(
'%eigh^+for rum.*%nine^+for fun.*%two-thousands are+to run*a civilized classroom.', //source string
['%','^','*','+'], //Patterns to replace
['The ','teen-hundreds were',^J,' a time '])//Replace pattern with.
\$\endgroup\$
4
  • \$\begingroup\$ See rules: "You cannot use the characters 0123456789" \$\endgroup\$
    – Paul R
    Commented Oct 24, 2014 at 11:02
  • \$\begingroup\$ @PaulR Oops, forgot the newline contained numbers -.-; Changed it, saved me 2 characters aswell :P \$\endgroup\$
    – Teun Pronk
    Commented Oct 24, 2014 at 11:09
  • \$\begingroup\$ Better, but I still see 0 and 1 in there... \$\endgroup\$
    – Paul R
    Commented Oct 24, 2014 at 11:18
  • \$\begingroup\$ Oh wow... can't believe I missed that xD \$\endgroup\$
    – Teun Pronk
    Commented Oct 24, 2014 at 12:10
1
\$\begingroup\$

Java: 252 bytes

class M{public static void main(String a[]){String t="teen-hundreds were a";for(int i='!'-'!';i<'z'-'a';i++){System.out.println("The eigh"+t+" time for rum.\nThe nine"+t+" time for fun.\nThe two-thousands are a time to run\na civilized classroom.");}}}

ungolfed:

    class M {
    public static void main(String a[]) {
        String t = "teen-hundreds were a";
        for (int i = '!' - '!'; i < 'z' - 'a'; i++) {
            System.out
                    .println("The eigh"
                            + t
                            + " time for rum.\nThe nine"
                            + t
                            + " time for fun.\nThe two-thousands are a time to run\na civilized classroom.");
        }
    }
}
\$\endgroup\$
1
  • 1
    \$\begingroup\$ 1) This doesn't compile (you're missing a } or have an extra {, take your pick). 2) This has been done already in the same language using the same method with 35+ less bytes, so doesn't add anything. 3) It doesn't compile. Note: I didn't downvote this, but I can see why someone would. Also note that voting is intended to be anonymous, and there's no requirement (even morally, IMO) to explain a downvote. \$\endgroup\$
    – Geobits
    Commented Oct 24, 2014 at 15:50
1
\$\begingroup\$

MATLAB 175 193

R2014a

Fun with fprintf. I hope I didn't miscount, first timer here.

a = 'a time ';b = 'teen-hundreds were %sfor';for i = length([]):length(b);fprintf(['The eigh',b,' rum.\nThe nine',b,' fun.\nThe two-thousands are %sto run\na civilized classroom.\n'],a,a,a);end

Ungolfed

a = 'a time ';
b = 'teen-hundreds were %sfor';
for i = length([]):length(b);
    fprintf(
        [
            'The eigh',
            b,
            ' rum.\nThe nine',
            b,
            ' fun.\nThe two-thousands are %sto run\na civilized classroom.\n'
        ],
        a,
        a,
        a
    );
end

Note that fprintf prints to MATLAB's console by default, unless a valid file identifier is supplied as the first argument. The character sequence %1$s instructs fprintf to print the first argument after the format string as a string. In this case, the variable b needs to be 25 characters long, so using %s instead of %1$s actually costs a couple more characters overall, once all strings have been manipulated.

Edit: fixed to conform to rules. Lesson learned: don't post early morning.

\$\endgroup\$
1
  • \$\begingroup\$ Fixed to conform to rules. How embarrassing! \$\endgroup\$ Commented Oct 24, 2014 at 18:54
1
\$\begingroup\$

Shell, 161

sed 's/x/xxxxx/g;s/x/The eigh#rum.\nThe nine#fun.\nThe two-thousands are a time to run\na civilized classroom.\n/g;s/#/teen-hundreds were a time for /g'<<<xxxxx
\$\endgroup\$
1
\$\begingroup\$

Haskell - 183

a#b="The "++a++"teen-hundreds were a time for "++b++".";
main=forM_['A'..'Y'](\_->forM["eigh"#"rum","nine"#"fun","The two-thousands are a time to run\na civilized classroom"]putStrLn)

Required imports:

import Control.Monad
import Data.Char
import Data.List
\$\endgroup\$
1
\$\begingroup\$

Rebol - 162 160

b: a:"teen-hundreds were a time"forall b[print reword{The eigh$X for rum.
The nine$X for fun.
The two-thousands are a time to run
a civilized classroom.}[X a]]
\$\endgroup\$
1
\$\begingroup\$

Groovy - 149

Golfed:

x="teen-hundreds were a time";print"""The eigh$x for rum.
The nine$x for fun.
The two-thousands are a time to run
a civilized classroom.
"""*x.size()  
\$\endgroup\$
1
\$\begingroup\$

Cobra - 194

class P
    def main
        print ('[n="\nThe "]eigh'+(p='teen-hundereds we[m="re a time "]for ')+'rum.[n]nine[p]fun.[n]two-thousands a[m]to run\na civilized classroom.\n').repeat(c'S'to int-c':'to int)
\$\endgroup\$
0
1
\$\begingroup\$

Haskell (210 192 chars)

My code is fairly simple:

import Data.Char
i x y="The "++x++"teen-hundreds were a time for "++y++".\n"
main=putStr.unlines.replicate(ord '\EM')$(i"eigh""rum"++i"nine""fun"++"The two-thousands are a time to run\na civilized classroom.")

Joins a 25x replicated list of the desired string and prints it. (\EM is ASCII 25)

Edit

Updated score to omit import and trailing newline from count.

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

PowerShell

Count = 203 199

$c,$d,$e,$f,$g,$h,$i,$j=("The,eigh, for ,rum.,nine,fun., to run, a time"-split",");$a="teen-hundreds were$j";[char[]]$a|%{"$c $d$a$e$f`n$c $g$a$e$h`n$c two-thousands are$j$i`na civilized classroom."}

Explanation

# Chop up this string of repeated words/phrases
$c,$d,$e,$f,$g,$h,$i,$j=("The,eigh, for ,rum.,nine,fun., to run, a time"-split",");

# Steal everyone else's idea to get 25 chars exactly
$a="teen-hundreds were$j";

# Cast to char array and pipe into foreach
[char[]]$a|%{...}

# Spell everything out
"$c $d$a$e$f`n$c $g$a$e$h`n$c two-thousands are$j$i`na civilized classroom."
\$\endgroup\$
1
  • \$\begingroup\$ 181 Bytes \$\endgroup\$
    – Veskah
    Commented Apr 15, 2019 at 13:07
1
\$\begingroup\$

Groovy : 167 chars

Inspired by jmm's answer.

a="teen-hundreds were a time for"
b="two-thousands are a time "
s="The eigh$a rum.\nThe nine$a fun.\nThe ${b}to run\na civilized classroom."
b.size().times{println s}
\$\endgroup\$
1
\$\begingroup\$

Ruby, 198 bytes

a='teen-hundreds were a time'
b='The eigh'
c='The nine'
d=' for'
e=' rum'
f=' fun'
a.length.times{puts b+a+d+e+"\n"+c+a+d+f+"\n The two-thousands were a time to run a \n civilized classroom"}
\$\endgroup\$
1
\$\begingroup\$

Scala - 159

val(f,h)=('z'-'a',"teen-hundreds were a time for")
print(s"""The eigh$h rum.
The nine$h fun.
The two-thousands are a time to run
a civilized classroom.
"""*f)
\$\endgroup\$
1
  • \$\begingroup\$ Run with scala golf.scala \$\endgroup\$
    – triggerNZ
    Commented Oct 28, 2014 at 5:20
1
\$\begingroup\$

T-SQL - 177

Using the string from the other T-SQL answer here.

PRINT(REPLICATE(REPLACE('The eigh$rum.
The nine$fun.
The two-thousands are a time to run
a civilized classroom.','$','teen-hundreds were a time for '),ASCII('K')/LEN('AAA')))

Okay, this should properly follow the rules this time, silly me. I had almost completely forgotten about the super convenient REPLICATE function. ASCII('K') gives us 75, dividing that by LEN('AAA') which is 3 gives us the 25 we need. I could've used the character with the ASCII value 25, but having a control character seems like a bit of a cop out to me.

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

C99: 211

Doubt I'll be winning any prizes any time soon:

main(){char*s="The %steen-hundreds were %s for %s.\n",*t="a time",c='A';for(;c<'Z';++c){printf(s,"eigh",t,"rum");printf(s,"nine",t,"fun");printf("The two-thousands are %s to run\na civilized classroom.\n", t);}}
\$\endgroup\$
2
  • \$\begingroup\$ Golf it more by removing #include <stdio.h> and using main(){...} instead of void main(){...}. Also, char *s="..." can be written as char*s="..." to save one byte. Declaring c outside the loop an also save some more bytes:char*s="...",c; \$\endgroup\$
    – Spikatrix
    Commented Jun 3, 2015 at 5:47
  • \$\begingroup\$ @CoolGuy All done, and I went one better by stripping the first part of the for out and assigning c at the point it is declared. I considered switching the for to a while, but it would be a byte longer. e.g. while(c<'Z'){++c;} (18) vs for(;c<'Z';++c){} (17) \$\endgroup\$
    – Pharap
    Commented Jun 3, 2015 at 15:17
1
\$\begingroup\$

Perl 6, 147 bytes

my $t="teen-hundreds were a time for";say "The eigh$t rum.
The nine$t fun.
The two-thousands are a time to run
a civilized classroom." for 'a'..'y'

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ 'a'..'y' -> ^㉕ :P since it looks like unicode numbers are fine \$\endgroup\$
    – ASCII-only
    Commented Apr 16, 2019 at 12:19
  • 1
    \$\begingroup\$ 140? \$\endgroup\$
    – ASCII-only
    Commented Apr 16, 2019 at 12:24

Your Answer

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

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