Tell me more ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

I don't know who coined these words, and I'm not Irish, but I give you an Irish blessing:

May the road rise up to meet you
May the wind be always at your back
May the sun shine warm upon your face
The rains fall soft upon your fields
And until we meet again
May God hold you in the hollow of His hand

I was planning on posting this a few weeks from now, but it just dawned on me that yesterday was Saint Patrick's Day.

Rules:

  • Produce the above text exactly.
    (Feel free to break this rule for the sake of cleverness and amusement.)
  • The program must generate the text on its own accord. cat is not a valid solution.
  • The solution with the fewest characters "wins".

I saw slight variations in wording among versions of the blessing I obtained from the Internet, so I tried to average them out. Please use the version posted above. Also, I dropped the punctuation to make it a bit easier.

May the luck of the Irish enfold you.

share|improve this question

8 Answers

up vote 9 down vote accepted

Python, 143 chars

#coding:u8
print u'慍⁹桴⁥潲摡爠獩⁥灵琠敭瑥礠畯䴊祡琠敨眠湩⁤敢愠睬祡⁳瑡礠畯⁲慢正䴊祡琠敨猠湵猠楨敮眠牡灵湯礠畯⁲慦散吊敨爠楡獮映污潳瑦甠潰潹牵映敩摬ੳ湁⁤湵楴敷洠敥⁴条楡੮慍⁹潇⁤潨摬礠畯椠桴⁥潨汬睯漠⁦楈⁳慨摮'.encode("u16")[2:]

run at codepad.org

share|improve this answer

Haskell, 179 characters

e="\n "++['='..'z']++e;i r=[e!!div r 64,e!!r]
main=putStr$i.fromEnum=<<"뒦뾁빭몁뷴릩끷뮸몁뺵끹봁벪몹끾봺뀒릾끹뭪끼뮳멁맪끦뱼릾븁릹끾봺뷁맦먰뀒릾끹뭪끸뺳끸뭮볪끼릷벁뺵봳끾봺뷁뫦먪뀙뭪끷릮본끫릱뱁븴뫹끺뵴볁뾴뺷끫뮪뱩븀놳멁뺳빮뱁뼪끲몪빁리릮변뒦뾁댴멁뭴뱩끾봺끮볁빭몁뭴뱱봼끴뫁덮븁뭦볩뀀"

This exploits the ancient common bond between the Irish and the Koreans. You all knew that lace and potato farming came via Korea, and that Kimchi was first made in Dublin... right?


  • Edit: (197 -> 184) No need to mod (why⁈ :-) ); eliminated separate declaration for the Korean text.
  • Edit: (184 -> 179) Used a more compact to represent code book.
share|improve this answer
Hahaha, nice! That's why I'm usually careful to say "solution with the fewest characters" (I edited my post accordingly). Exploiting Unicode is always an option, but few people take it. – Joey Adams Mar 18 '11 at 14:06
Isn't it possible to put three our four chars into one exploiting this way? – FUZxxl Mar 18 '11 at 19:24
@FUZxxl: You have to be careful: Not all values in the range 0x0 ~ 0x10FFFF are usable. Some are outright banned (0xD800 ~ 0xDFFF for example and any value ending in FFFE or FFFF), others may or may not be legal in a given programming language's lexical definition. I choose Hangul here because it is a large block of values with no holes, and all certainly legal in any definition of Unicode string. But, it is only ~13 bits in size. – MtnViewMark Mar 18 '11 at 19:31
MtnViewMark: If you have two consecutive surrogates then it is indeed valid and would be a single codepoint outside the BMP. That would require that the implementation uses UTF-16 and could cut your character needs by one ;) – Joey Mar 23 '11 at 9:43
@Joey - You could only use surrogates if every appearance of them were paired, and in proper order (one from 0xD800~0xDBFF and the next from 0xDC00~0xDFFF). But, in Haskell's case it is moot: String is a sequence of unicode scalar values (U+0000 ~ U+D7FF & U+E000 ~ U+10FFFF), not UTF-16 code units. Note that fromEnum returns the character's code point scalar value, not some encoded value. – MtnViewMark Mar 24 '11 at 2:05

GolfScript (204 chars)

Contains non-printing characters, so copy-paste may not work:

:k'May the road rise up to meet you
wind be always ar back¢ sun shin¬armÈon€face
Tåainsll soft¡ields
Aäuntil we meet ag²áGod holdø inñlow of His hand'{k{{k$}*0:k;}{127.2$<{-:k}*;}if}/](+

Base64-encoded:

OmsnTWF5IHRoZSByb2FkIHJpc2UgdXAgdG8gbWVldCB5b3UKnwh3aW5kIGJlIGFsd2F5cyBhnAVy
IGJhY2uiCXN1biBzaGlurANhcm3IA29upAZmYWNlClTlBGFpbnONA2xsIHNvZnShDGllbGRzCkHk
A3VudGlsIHdlIG1lZXQgYWeyA+EFR29kIGhvbGT4BCBpbvEFjgNsb3cgb2YgSGlzIGhhbmQne2t7
e2skfSowOms7fXsxMjcuMiQ8ey06a30qO31pZn0vXSgr

There really is less redundancy than you might expect in the string. I think gzip's savings are 2/3 from Lempel-Ziv and 1/3 from the Huffman encoding; what I'm using is essentially LZ, but I have more overhead than the gzip format.

Note that this is the first solution to take fewer bytes than the output.

share|improve this answer

Pseudocode (just for fun, no char count)

do {
  s = random_string(205);
} while (md5(s) != 0x37c9654967bc684c22fd3a42f68fff9d);
print s
share|improve this answer
5  
This might just print another message with the same hash. So please include at least a proof that the required sequence is the only 205-character sequence resulting in that hash. – Joey Mar 20 '11 at 22:19
2  
Cannot work anyway, since the text has 210 characters, not 205. So it's always wrong, regardless what it outputs. – Joey Mar 23 '11 at 7:48
3  
What's your reasoning for thinking it highly unlikely that more than one 205-character sequence has that MD5? 205 chars * 8 bits/char = 1640 bits, an MD5 sum is 128 bits, so on average there are 2^(1640/128) ~= 7200 205-character sequences which map to any given MD5 sum. – Peter Taylor Jan 21 '12 at 9:51
1  
@smci, if he uses a hash which is long enough to reduce the probability of a collision below 0.5, it's no shorter than just reproducing the original text. – Peter Taylor Jan 21 '12 at 12:08
2  
Assuming that the RNG has a 64-bit seed, it can generate no more than 2^64 distinct strings that way, so the chances that this fixes the issue are still remote. The fundamental problem is that most strings are incompressible (fewer than half can be compressed by a single bit), and your approach doesn't exploit any structure of the string, so it can't work. – Peter Taylor Jul 1 '12 at 7:49
show 6 more comments

PHP, 431 425 bytes

<?php $s="May therodisupm\nwnblckfTAgGH";$p=array('01234563','3cd8h328c73m','jj','3e6643');$b=str_split('s781937ab63cd348v28cfsgah93i631jg12b314328c73i1klfsbch3b5ah63g17et1k6fn56371ahb3m1u3b8m4ta6j9bfoh93ch4aj3g6v1p1ahf0123q89358j9328c3ah3456358u8g38m3rab351h9');foreach($b as $x){$x=b($x);if($x>27){$c=str_split($p[$x-28]);foreach($c as $y){echo $s[b($y)];}}else{echo $s[$x];}}function b($a){return base_convert($a,36,10);}

An approach of mapping and base conversion to store the information. However, I failed at keeping the program size very small.

share|improve this answer

Haskell - 284

s n=words"And God His May The again always at back be face fall fields hand hold hollow in meet of rains rise road shine soft sun the to until up upon warm we wind you your"!!(fromEnum n-48)
main=mapM_(putStrLn.unwords.map s)$words"3IEDLJAQ 3IP967R8 3IHFNMR: 4C;GMR< 0KOA5 31>Q@I?B2="

Sadly, this is much longer than the output or putting the string verbatim. Even the string literals themselves (without quotes) total to two characters longer than the input. How can that be?

share|improve this answer

Bash/Sed, 206 chars

I didn't manage to beat Peter Taylor, but like his solution, it's fewer bytes than the original. But I didn't use unprintable characters.
sed was useful in the similar "no strangers to codegolf" challenge. But there I used it twice, to compress the list of replacements. Here, the text is too short for this trick.

sed 's/Z/May the /;s/W/ uponYr f/;s/Y/ you/'<<X
Zroad rise up to meetY
Zwind be always atYr back
Zsun shine warmWace
The rains fall softWields
And until we meet again
May God holdY in the hollow of His hand
share|improve this answer

ROT13, 210

Znl gur ebnq evfr hc gb zrrg lbh
Znl gur jvaq or nyjnlf ng lbhe onpx
Znl gur fha fuvar jnez hcba lbhe snpr
Gur envaf snyy fbsg hcba lbhe svryqf
Naq hagvy jr zrrg ntnva
Znl Tbq ubyq lbh va gur ubyybj bs Uvf unaq
share|improve this answer
I think you mean 215. And I'm not sure that rot13 is a programming language... – Peter Taylor Sep 18 '12 at 15:10
@PeterTaylor, rot13 has been used in other code golf questions (but in no way can it be considered a serious answer). The greasemonkey script that was designed for this site recognizes ROT13, but also lets me know it's 210 chars, so I'll fix that – Sean Cheshire Sep 18 '12 at 15:15
It's 215 chars, the same as the original text. The script must be not counting newlines. – Peter Taylor Sep 18 '12 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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