3
\$\begingroup\$

Your program must print out the Gettysburg Address.

I copied this text from Wikipedia:

Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth.

There are two different tests:

  1. You may use system decompression software
  2. No using system decompression software

Additionally, none of the words in the Address can appear in plain text in your code (with a non-alpha character before and after). Shortest code wins. Good luck!

\$\endgroup\$
7
  • 2
    \$\begingroup\$ What do you mean by "There are two different tests"? Are we supposed to use system decompression software? Or not to use it? \$\endgroup\$
    – Howard
    Nov 25, 2013 at 16:53
  • 3
    \$\begingroup\$ Also it adds litte to nothing new in comparison to other compression quests. \$\endgroup\$
    – Howard
    Nov 25, 2013 at 16:56
  • \$\begingroup\$ Make one program that uses them, and one that doesn't. \$\endgroup\$
    – ike
    Nov 25, 2013 at 16:57
  • \$\begingroup\$ I'm adding that you cannot have plain text of any words in the address in code. \$\endgroup\$
    – ike
    Nov 25, 2013 at 16:58
  • \$\begingroup\$ how important is punctuation? specifically, the hyphens? \$\endgroup\$
    – smcg
    Nov 26, 2013 at 22:11

4 Answers 4

18
\$\begingroup\$

Mathematica 40

Note: Not to be taken as a serious answer. ;)

Just for fun:

ExampleData@{"Text","GettysburgAddress"}

Four score and seven years ago, our fathers brought forth upon this continent a new nation: conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war...testing whether that nation, or any nation so conceived and so dedicated. . . can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field as a final resting place for those who here gave their lives that this nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we cannot dedicate...we cannot consecrate... we cannot hallow this ground. The brave men, living and dead, who struggled here have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember, what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us...that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion... that we here highly resolve that these dead shall not have died in vain...that this nation, under God, shall have a new birth of freedom...and that government of the people, by the people, for the people, shall not perish from this earth.

\$\endgroup\$
6
  • \$\begingroup\$ "none of the words in the Address can appear in plain text in your code" I can see an a in your code ;-) \$\endgroup\$
    – Howard
    Nov 25, 2013 at 16:51
  • \$\begingroup\$ @Howard You may be right. \$\endgroup\$
    – DavidC
    Nov 25, 2013 at 16:56
  • 1
    \$\begingroup\$ I mean with a space before and after. \$\endgroup\$
    – ike
    Nov 25, 2013 at 16:58
  • \$\begingroup\$ It may or may not be worth noting that the punctuation is slightly different in this version. I'm not sure that that should disqualify it, though. \$\endgroup\$
    – breadbox
    Nov 25, 2013 at 21:41
  • 3
    \$\begingroup\$ Even the words vary from version to version. See abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm \$\endgroup\$
    – DavidC
    Nov 25, 2013 at 22:36
6
\$\begingroup\$

Tcl, 759, no compression

puts [encoding convertt unicode 潆牵猠潣敲愠摮猠癥湥礠慥獲愠潧漠牵映瑡敨獲戠潲杵瑨映牯桴漠桴獩挠湯楴敮瑮愠渠睥渠瑡潩Ɱ挠湯散癩摥椠楬敢瑲ⱹ愠摮搠摥捩瑡摥琠桴⁥牰灯獯瑩潩桴瑡愠汬洠湥愠敲挠敲瑡摥攠畱污‮潎⁷敷愠敲攠杮条摥椠⁡牧慥⁴楣楶慷Ⱳ琠獥楴杮眠敨桴牥琠慨⁴慮楴湯‬牯愠祮渠瑡潩潳挠湯散癩摥愠摮猠敤楤慣整Ɽ挠湡氠湯⁧湥畤敲‮敗愠敲洠瑥漠⁡牧慥⁴慢瑴敬楦汥⁤景琠慨⁴慷⹲圠⁥慨敶挠浯⁥潴搠摥捩瑡⁥⁡潰瑲潩景琠慨⁴楦汥Ɽ愠⁳⁡楦慮敲瑳湩⁧汰捡⁥潦⁲桴獯⁥桷敨敲朠癡⁥桴楥⁲楬敶⁳桴瑡琠慨⁴慮楴湯洠杩瑨氠癩⹥䤠⁴獩愠瑬杯瑥敨⁲楦瑴湩⁧湡⁤牰灯牥琠慨⁴敷猠潨汵⁤潤琠楨⹳䈠瑵‬湩愠氠牡敧⁲敳獮ⱥ眠⁥慣潮⁴敤楤慣整‬敷挠湡渠瑯挠湯敳牣瑡ⱥ眠⁥慣潮⁴慨汬睯琠楨⁳牧畯摮‮桔⁥牢癡⁥敭Ɱ氠癩湩⁧湡⁤敤摡‬桷瑳畲杧敬⁤敨敲‬慨敶挠湯敳牣瑡摥椠ⱴ映牡愠潢敶漠牵瀠潯⁲潰敷⁲潴愠摤漠⁲敤牴捡⹴吠敨眠牯摬眠汩楬瑴敬渠瑯ⱥ渠牯氠湯⁧敲敭扭牥眠慨⁴敷猠祡栠牥ⱥ戠瑵椠⁴慣敮敶⁲潦杲瑥眠慨⁴桴祥搠摩栠牥⹥䤠⁴獩映牯甠⁳桴⁥楬楶杮‬慲桴牥‬潴戠⁥敤楤慣整⁤敨敲琠桴⁥湵楦楮桳摥眠牯桷捩⁨桴祥眠潨映畯桧⁴敨敲栠癡⁥桴獵映牡猠潮汢⁹摡慶据摥‮瑉椠⁳慲桴牥映牯甠⁳潴戠⁥敨敲搠摥捩瑡摥琠桴⁥牧慥⁴慴歳爠浥楡楮杮戠晥牯⁥獵琭慨⁴牦浯琠敨敳栠湯牯摥搠慥⁤敷琠歡⁥湩牣慥敳⁤敤潶楴湯琠桴瑡挠畡敳映牯眠楨档琠敨⁹慧敶琠敨氠獡⁴畦汬洠慥畳敲漠⁦敤潶楴湯琭慨⁴敷栠牥⁥楨桧祬爠獥汯敶琠慨⁴桴獥⁥敤摡猠慨汬渠瑯栠癡⁥楤摥椠慶湩琭慨⁴桴獩渠瑡潩Ɱ甠摮牥䜠摯‬桳污慨敶愠渠睥戠物桴漠⁦牦敥潤⵭湡⁤桴瑡朠癯牥浮湥⁴景琠敨瀠潥汰ⱥ戠⁹桴⁥数灯敬‬潦⁲桴⁥数灯敬‬桳污潮⁴数楲桳映潲桴⁥慥瑲⹨]
\$\endgroup\$
2
  • \$\begingroup\$ This isn't the shortest, but it's the only real answer that fulfills the no plaintext words in code rule. So it wins. \$\endgroup\$
    – ike
    Dec 1, 2013 at 13:08
  • \$\begingroup\$ Tcl winning! YES! \$\endgroup\$
    – sergiol
    Jun 29, 2017 at 22:37
2
\$\begingroup\$

Python 2.7, no decompression, 962 characters

"eJxlVEGO2zAM/AofYOQRPbTopacCPdMWbQsri6kk28jvOxTjbNpegliiyJnhkF91L1QnLUKcA1U5JNNDuFTiRcluZ26r4Hssui9ro1lLW0kztTVWmjS3mCU3YspyUuYWNQ92Pkk8JFDMlOIopT2GXiNIiBM33DRFDqF70bvWaO/wzciUEm3AwUA1Femx8nvndKMfetIp/UbywovnZ1osjKZ4xEQnl4GaVOBa6FzF4HviC5wWIHk8P6nqG9qugn6CBBMGAUUqyWEvcqNfXn+TZipctUduLckcJQXS2esBSQ9f+QAT3cQoX6nx8g4pDcEV319DJYiP/5kTlSeNe+JJTHoEahXQUgItocVSg2EsUPmQ6one2NIWrWt2eaPvjdAzTk0Xl2WOrec32taHSyloXFfdwSVob/SNvuxtcLETlwWBVXKVwUJNoqztRe2vQ2hbZSr/Hq/oMprZTbTAWjnc6CfcMBZjhPYPhvnCFoQhjLGurezLktAq4z9c2l414AfAnBkdHhU35uC7qv2cRk6JQzADBGmFp+ZFTy2gekYYL0Xro0FE8ozA3vsim2wwMSA81eHHE8C4Q9TmvDA+xboEdT0SIj8oRAd76W9t3Gv3vlMcqPQhGwzfKG8j0nv8nJM9wxOxrjgG3g8UiNPqFUyY2cezv1jdFShiSsDPWcf0APWDYfRwAfGqLzy9dn//34y6xxvXD5OCgQOijDLb4tjr8LRv0c2i4c9VIZ1430yuxh8C89g01358qM+7+tOJ9+r+fmN1eRuGq8i+97XAFUNoE3PlGF6OdeqwO6hicDT1596FKo6lmu+eBsR1iL5BDlAarmAoc20K2BICfVOYz1/2V77qxtgX4QzeIkE3X289xwLrlbzZWuyzjSUnek/mlsdfnz7Rn9+f8DCK6PVLU8JObuvtD0gQCHY=".decode('base64').decode('zlib')

For fun, Python 2.7, no decompression, 1470 characters

"Sbhe fpber naq frira lrnef ntb bhe snguref oebhtug sbegu ba guvf pbagvarag n arj angvba, pbaprvirq va yvoregl, naq qrqvpngrq gb gur cebcbfvgvba gung nyy zra ner perngrq rdhny. Abj jr ner ratntrq va n terng pvivy jne, grfgvat jurgure gung angvba, be nal angvba fb pbaprvirq naq fb qrqvpngrq, pna ybat raqher. Jr ner zrg ba n terng onggyrsvryq bs gung jne. Jr unir pbzr gb qrqvpngr n cbegvba bs gung svryq, nf n svany erfgvat cynpr sbe gubfr jub urer tnir gurve yvirf gung gung angvba zvtug yvir. Vg vf nygbtrgure svggvat naq cebcre gung jr fubhyq qb guvf. Ohg, va n ynetre frafr, jr pna abg qrqvpngr, jr pna abg pbafrpengr, jr pna abg unyybj guvf tebhaq. Gur oenir zra, yvivat naq qrnq, jub fgehttyrq urer, unir pbafrpengrq vg, sne nobir bhe cbbe cbjre gb nqq be qrgenpg. Gur jbeyq jvyy yvggyr abgr, abe ybat erzrzore jung jr fnl urer, ohg vg pna arire sbetrg jung gurl qvq urer. Vg vf sbe hf gur yvivat, engure, gb or qrqvpngrq urer gb gur hasvavfurq jbex juvpu gurl jub sbhtug urer unir guhf sne fb aboyl nqinaprq. Vg vf engure sbe hf gb or urer qrqvpngrq gb gur terng gnfx erznvavat orsber hf—gung sebz gurfr ubaberq qrnq jr gnxr vapernfrq qribgvba gb gung pnhfr sbe juvpu gurl tnir gur ynfg shyy zrnfher bs qribgvba—gung jr urer uvtuyl erfbyir gung gurfr qrnq funyy abg unir qvrq va inva—gung guvf angvba, haqre Tbq, funyy unir n arj ovegu bs serrqbz—naq gung tbireazrag bs gur crbcyr, ol gur crbcyr, sbe gur crbcyr, funyy abg crevfu sebz gur rnegu.".encode('rot13')
\$\endgroup\$
3
  • \$\begingroup\$ Very unorginal. But it works. +1 \$\endgroup\$ Nov 26, 2013 at 21:29
  • \$\begingroup\$ also I'm fooling around with other python encodings... currently they seem to be a bit lossy with the gettysburg address \$\endgroup\$
    – smcg
    Nov 26, 2013 at 22:09
  • 3
    \$\begingroup\$ the rot13 solution contains " or " which is in the original text. \$\endgroup\$
    – Cruncher
    Nov 27, 2013 at 14:36
1
\$\begingroup\$

Perl, 932 bytes (no system decompression)

This entry is not a UTF-8-encoded file. Perl 5 uses 8-bit characters as its default character set for scripts. Since the website does use UTF-8, I'm posting a base64-encoded version of my submission:

c3ViIGJ7JCRfP2IoQCQkXyk6cHJpbnQgZm9yQF99c3ViIGF7JHtjaHIoKX09W3BvcCxwb3BdZm9y
IDE0OS4uMjU1OyZifWEiRpjQY/P71K123iB5Zepz3GfAmOthxHO7ctivvfog9fbBynTy3vlhlneq
98qg16LMaWL8dHn31JvounLCb3O/5tth/yCuIKZj7PHvZXF1/eNOsiDgpt6cZ6LcIJpj12lsIHfq
93S2peFlxNtuzvfa8Hmq0MDKoNfv1HPA0WW3zcz12d5kdezjV/ump/n13CCaYvF0bGVmaWWfx9t3
6uNX+8VjuPvoINH7YSBw87Ugx9tmaWVst8/c6/L9IOxzpXBsYWP7vfZvc/vhwMic6fplaXLM17bb
1W7OIG1pr5dlncH96GdlxOu/pdRwcsL82+BzaNifZG/25+NC/vfy3MzqZ/zQ3nOe0Z7KrWNy8Z68
svbBZ3LYbmTjVGj7Yr7prveXxtSkt+Fv0HRydWdnbO/d5cXKrWNy8e+/92bq3GJv6ZggcG/acLL8
s9xk+NrudL5jdONUaPt38593af/Mv3Rs+25vdOVu2mz12eynbWL8IOH04HNhyd3lYv4gafnNlnb8
6/NnZfnh9PqV3/jdZZ3n69rD4pfyZ/e+xPfou/ubyOjidW5m8udo73fzayDhaWNo9pXhb+vYr8jF
+sPr6tBv0mJsedxkdvCgZJ3BvsTr2sOzu/vIm+jimnTPayDsbWHyxmJlvfvDmWZyuPa2+2j18++k
+OB0YWv78mPsz+/udm+1s9tjYcP7ZtrhaWNo9pWc6fr7bM/5ZnX/IKfPdXL7xyDudm+1meDIaGm5
bMnsc29s6dX6tvuk+KvLxd+iIHZh8pn656r3dW5k/CBHb7erIMVhlne7aXL6IMfr7GVkuC3U1Wdv
dvxurvnHo2J5o72jq8tw/Odo63K44mXq+i5sbHR1bGFyZSBlaHQgdCBkICz6IG5v+WFyb25pdGFu
YfhlZWRuIGVyZiByYft2b3RzafVp92VhaCAu+/Zod/t3aWRuZfxoYSD09iDzIGd1b3ZpY9/0+vjw
8dZv7dPucyBzYebx8GNsIPnS9WMgefvdZm/Z8unk/PpzdXBvIOcgb3RpYXLzZv/kYiBw4mhnbW/3
ZHNl5nTCZeggd2/lbLS6+bnebWVzzeC8c87trOX07GVt++rGdGHusbDy70njZWP4bMup+aFhZ+/R
qGfVLXLY12xl7cllIj1+Ly4vZ3M=

This is what the script looks like with the non-ASCII characters replaced with question marks, and some line breaks added for readability:

sub b{$$_?b(@$$_):print for@_}sub a{${chr()}=[pop,pop]for 149..255;&b}
a"F??c????v? ye?s?g???a?s?r???? ????t???a?w???????ib?ty?????r?os???a? ? ?c???equ??N? ????
g?? ?c?il w??t???e??n????y????????s??e??????du??W?????? ?b?tlefie???w??W??c??? ??a p?? ??
fiel?????? ?s?plac???os???????eir?????n? mi??e????ge?????pr????sh??do???B??????g???s?????
cr??????gr?nd?Th?b??????????o?truggl??????cr????f??bo?? po?p????d???t?ct?Th?w??wi???tl?no
t?n?l????mb? ???sa???b? i???v???ge????????e????????g???????????unf??h?w?k ?ich???o???????
???o?bly?dv??d???????????????t?k ?ma??be????fr????h??????tak??c????vo???ca??f??ich??????l
??fu? ??ur?? ?vo????hi?l??sol???????????? va??????und? Go?? ?a?w?ir? ???ed?-??gov?n????by
?????p??h?r??e??.lltulare eht t d ,? no?aronitana?eedn erf ra?votsi?i?eah .??hw?widne?ha 
?? ? guovic???????o???s sa???cl ???c y??fo??????supo ? otiar?f??b p?hgmo?dse?t?e? wo?l???
??mes???s??????em???ta?????I?ec?l????ag???g?-r??le??e"=~/./gs

As @Howard mentioned, this doesn't add much to previous kolmogorov-complexity golf challenges. My encryption scheme, sometimes referred to as "re-pair compression" is one I've used before so I won't go into details again here. In short, it's not a very efficient compression scheme, but it has the advantage of requiring very little code for the decompressor. The compressed string itself occupies 638 characters. (The period near the start of the third-to-last line is where the compressed string ends in the source code quoted above.) The remaining 214 characters of the string is the compression dictionary, leaving 80 characters that make up the Perl script proper.

\$\endgroup\$
2
  • \$\begingroup\$ I asked this to confirm my long-held suspicion that the Gettysburg Address was written by a computer, now I see it was:) \$\endgroup\$
    – ike
    Nov 26, 2013 at 1:43
  • \$\begingroup\$ Technically this has the word "for" \$\endgroup\$
    – ike
    Nov 27, 2013 at 11:54

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