This question already has an answer here:

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!

marked as duplicate by Mego, DJMcMayhem, NinjaBearMonkey, NoOneIsHere, Picard Sep 9 '16 at 1:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

Tcl, 759, no compression

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

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.

  • "none of the words in the Address can appear in plain text in your code" I can see an a in your code ;-) – Howard Nov 25 '13 at 16:51
  • @Howard You may be right. – DavidC Nov 25 '13 at 16:56
  • 1
    I mean with a space before and after. – ike Nov 25 '13 at 16:58
  • 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. – breadbox Nov 25 '13 at 21:41
  • 3
    Even the words vary from version to version. See abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm – DavidC Nov 25 '13 at 22:36

C#, no decompression. 323.

I'm proud to say that C# has finally got a short solution!

using C=System.Console;class A{static void Main(){foreach(var n in System.Xml.Linq.XElement.Parse(System.Text.Encoding.UTF8.GetString(new System.Net.WebClient().DownloadData("http://is.gd/UQlNqN"))).Descendants("blockquote")){C.Write(System.Text.RegularExpressions.Regex.Replace(n+"", @"<(.|\n)*?>", ""));break;}C.Read();}}

Slightly cheaty because it downloads it from The Wiki, but it meets all the requirements. If you want you can remove the UTF8 encoding, but you will get a few cases of weird chars (mainly the long lines: whatever those are!) I like it being right though :P

  • This fails. It has the word "in" just at first glance. Also, does it print out the whole Wikipedia page, or just the Address? – ike Nov 27 '13 at 11:53
  • 1
    @user85686 I wouldn't be too hard on him using "in". I think you need to look at the spirit in which that rule was put in place. As for printing the whole wikipedia page, no. It will only print the first "blockquote" element. Go to the wikipedia page, view the source and look for the blockquote elements. – Cruncher Nov 27 '13 at 14:44
  • You can shave off one character by using a shorter shortening service (e.g. is.gd/UQlNqN) – ike Nov 27 '13 at 15:16

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.

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

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')
  • Very unorginal. But it works. +1 – It'sNotALie. Nov 26 '13 at 21:29
  • also I'm fooling around with other python encodings... currently they seem to be a bit lossy with the gettysburg address – smcg Nov 26 '13 at 22:09
  • 2
    the rot13 solution contains " or " which is in the original text. – Cruncher Nov 27 '13 at 14:36

PHP - 44

Mega cheating, inspired by solution from It'sNotALie. Don't take this as a real solution to the problem.

Literally just echos the contents of a text file hosted in Dropbox and link shortened.

<?=file_get_contents('http://is.gd/eXG22d');
  • <?= shorthand for <?php echo
  • Don't need a closing ?> if it's the last line in the document

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