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:
- You may use system decompression software
- 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!
-
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– Howard2013年11月25日 16:53:06 +00:00Commented Nov 25, 2013 at 16:53
-
3\$\begingroup\$ Also it adds litte to nothing new in comparison to other compression quests. \$\endgroup\$Howard– Howard2013年11月25日 16:56:30 +00:00Commented Nov 25, 2013 at 16:56
-
\$\begingroup\$ Make one program that uses them, and one that doesn't. \$\endgroup\$ike– ike2013年11月25日 16:57:29 +00:00Commented 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– ike2013年11月25日 16:58:18 +00:00Commented Nov 25, 2013 at 16:58
-
\$\begingroup\$ how important is punctuation? specifically, the hyphens? \$\endgroup\$smcg– smcg2013年11月26日 22:11:55 +00:00Commented Nov 26, 2013 at 22:11
4 Answers 4
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.
-
\$\begingroup\$ "none of the words in the Address can appear in plain text in your code" I can see an
ain your code ;-) \$\endgroup\$Howard– Howard2013年11月25日 16:51:48 +00:00Commented Nov 25, 2013 at 16:51 -
\$\begingroup\$ @Howard You may be right. \$\endgroup\$DavidC– DavidC2013年11月25日 16:56:00 +00:00Commented Nov 25, 2013 at 16:56
-
1\$\begingroup\$ I mean with a space before and after. \$\endgroup\$ike– ike2013年11月25日 16:58:59 +00:00Commented 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– breadbox2013年11月25日 21:41:32 +00:00Commented 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– DavidC2013年11月25日 22:36:48 +00:00Commented Nov 25, 2013 at 22:36
Tcl, 759, no compression
puts [encoding convertt unicode 潆牵猠潣敲愠摮猠癥湥礠慥獲愠潧漠牵映瑡敨獲戠潲杵瑨映牯桴漠桴獩挠湯楴敮瑮愠渠睥渠瑡潩Ɱ挠湯散癩摥椠楬敢瑲ⱹ愠摮搠摥捩瑡摥琠桴牰灯獯瑩潩桴瑡愠汬洠湥愠敲挠敲瑡摥攠畱污潎7敷愠敲攠杮条摥椠牧慥4楣楶慷Ⱳ琠獥楴杮眠敨桴牥琠慨4慮楴湯牯愠祮渠瑡潩潳挠湯散癩摥愠摮猠敤楤慣整Ɽ挠湡氠湯湥畤敲敗愠敲洠瑥漠牧慥4慢瑴敬楦汥景琠慨4慷圠慨敶挠浯潴搠摥捩瑡潰瑲潩景琠慨4楦汥Ɽ愠楦慮敲瑳湩汰捡潦桴獯桷敨敲朠癡桴楥楬敶桴瑡琠慨4慮楴湯洠杩瑨氠癩䤠4獩愠瑬杯瑥敨楦瑴湩湡牰灯牥琠慨4敷猠潨汵潤琠楨䈠瑵湩愠氠牡敧敳獮ⱥ眠慣潮4敤楤慣整敷挠湡渠瑯挠湯敳牣瑡ⱥ眠慣潮4慨汬睯琠楨牧畯摮桔牢癡敭Ɱ氠癩湩湡敤摡桷瑳畲杧敬敨敲慨敶挠湯敳牣瑡摥椠ⱴ映牡愠潢敶漠牵瀠潯潰敷潴愠摤漠敤牴捡吠敨眠牯摬眠汩楬瑴敬渠瑯ⱥ渠牯氠湯敲敭扭牥眠慨4敷猠祡栠牥ⱥ戠瑵椠4慣敮敶潦杲瑥眠慨4桴祥搠摩栠牥䤠4獩映牯甠桴楬楶杮慲桴牥潴戠敤楤慣整敨敲琠桴湵楦楮桳摥眠牯桷捩桴祥眠潨映畯桧4敨敲栠癡桴獵映牡猠潮汢9摡慶据摥瑉椠慲桴牥映牯甠潴戠敨敲搠摥捩瑡摥琠桴牧慥4慴歳爠浥楡楮杮戠晥牯獵琭慨4牦浯琠敨敳栠湯牯摥搠慥敷琠歡湩牣慥敳敤潶楴湯琠桴瑡挠畡敳映牯眠楨档琠敨9慧敶琠敨氠獡4畦汬洠慥畳敲漠敤潶楴湯琭慨4敷栠牥楨桧祬爠獥汯敶琠慨4桴獥敤摡猠慨汬渠瑯栠癡楤摥椠慶湩琭慨4桴獩渠瑡潩Ɱ甠摮牥䜠摯桳污慨敶愠渠睥戠物桴漠牦敥潤湡桴瑡朠癯牥浮湥4景琠敨瀠潥汰ⱥ戠9桴数灯敬潦桴数灯敬桳污潮4数楲桳映潲桴慥瑲]
-
\$\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– ike2013年12月01日 13:08:04 +00:00Commented Dec 1, 2013 at 13:08
-
\$\begingroup\$ Tcl winning! YES! \$\endgroup\$sergiol– sergiol2017年06月29日 22:37:29 +00:00Commented Jun 29, 2017 at 22:37
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')
-
\$\begingroup\$ Very unorginal. But it works. +1 \$\endgroup\$It'sNotALie.– It'sNotALie.2013年11月26日 21:29:22 +00:00Commented 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– smcg2013年11月26日 22:09:36 +00:00Commented Nov 26, 2013 at 22:09
-
3\$\begingroup\$ the rot13 solution contains " or " which is in the original text. \$\endgroup\$Cruncher– Cruncher2013年11月27日 14:36:53 +00:00Commented Nov 27, 2013 at 14:36
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.
-
\$\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– ike2013年11月26日 01:43:53 +00:00Commented Nov 26, 2013 at 1:43
-
\$\begingroup\$ Technically this has the word "for" \$\endgroup\$ike– ike2013年11月27日 11:54:47 +00:00Commented Nov 27, 2013 at 11:54