TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Cover Letter in Brainfuck

148 pointsby FBTalmost 11 years ago

14 comments

SonOfLilitalmost 11 years ago
Author here.<p>Due to popular request, I extracted the text from the PDF, it&#x27;s in a gist at the bottom.<p>A funny (on my account) story:<p>After three days with little sleep, the last half-day spent finding just one more byte to remove so it fits in a nice rectangle[1], I was finally done. I sent the complete .asm to Oded Margalit, an IBM researcher who organizes the CodeGuru programming competitions in Israel, and he immediately responded &quot;I can shave 5 bytes off&quot;.<p>It turns out instead of the &quot;quit&quot; system call all the books tell you to write:<p><pre><code> ;;; the program has finished quit: mov ah, 04ch ; quit with return code mov al, 0 int 021h </code></pre> You can just put a &quot;ret&quot;, and DOS loads an address containing these commands to the bottom of your stack so it works.<p>You had to see my reaction.<p>[1] it was supposed to be 32x13 characters at the bottom, after it was done I decided to make it 8x52 characters on the right because it looked better. Had I known I would do it, I could&#x27;ve gone to sleep much earlier...
评论 #7948421 未加载
评论 #7944971 未加载
amckennaalmost 11 years ago
For those wondering what the program does:<p>TL;DR - The program writes a Brainfuck program that writes the text you inputted. Pretty neat<p>First copy the text of the letter (excluding the x86 interpreter in hex on the right, or in the case of the gist, at the bottom) and run it through an online Brainfuck interpreter. Supply ASCII text input such as &quot;A&quot; and run the program. It will output another Brainfuck program. If you then run the outputted program through the Brainfuck interpreter you will get the same ASCII text.<p>So if you run the code extracted from the letter:<p><pre><code> +++++++++[&lt;+++++&gt;-],[[-&lt;--.++&lt;+&gt;&gt;(]&lt;+.-&lt;[-&gt;.&lt;]&gt;&gt;,] </code></pre> If input an &#x27;A&#x27; the output is:<p><pre><code> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.----------------------------------------------------------------- </code></pre> which if run returns an &#x27;A&#x27;<p>Online interpreter - <a href="http://nayuki.eigenstate.org/page/brainfuck-interpreter-javascript" rel="nofollow">http:&#x2F;&#x2F;nayuki.eigenstate.org&#x2F;page&#x2F;brainfuck-interpreter-java...</a>
评论 #7946304 未加载
kachnuv_ocasekalmost 11 years ago
The first ever Brainfuck program whose source doesn&#x27;t actually look bad.
评论 #7944232 未加载
评论 #7948387 未加载
acomjeanalmost 11 years ago
I have questions:<p>Did the letter work?<p>Program and interpreter and letter, but why not let us with X86 machines cut and paste.<p>What did the program do?
评论 #7944286 未加载
adestefanalmost 11 years ago
You get bonus points if you find a 32-bit Windows machine and use DEBUG to load in the interpreter. It&#x27;s like a modern day copy of BYTE.
informatimagoalmost 11 years ago
What&#x27;s wrong with a text file? Notice how brainfuck is specified to work on text files, not on PNG files!
评论 #7944220 未加载
评论 #7943920 未加载
danparsonsonalmost 11 years ago
That&#x27;s great :-) For other teeny DOS BF interpreters, see <a href="http://www.hugi.scene.org/compo/compoold.htm#compo6" rel="nofollow">http:&#x2F;&#x2F;www.hugi.scene.org&#x2F;compo&#x2F;compoold.htm#compo6</a> (1999) - smallest was 98 bytes!
评论 #7944475 未加载
maerF0x0almost 11 years ago
My guess is that most HR people would see that and think &quot;Troublemaker&quot;, Next..<p>But, then again, maybe you dont want to work for them anyways.
评论 #7944595 未加载
sheberightalmost 11 years ago
I found your extra byte!<p>s&#x2F;confered&#x2F;conferred&#x2F;
评论 #7945268 未加载
dreamweaponalmost 11 years ago
So you were expecting IDF human resource types to have a sense of humor?
评论 #7944635 未加载
greg7mdpalmost 11 years ago
This is brilliant!
essetialmost 11 years ago
so, what does the program do?
评论 #7944784 未加载
评论 #7944786 未加载
jebbluealmost 11 years ago
Kids may read HN, I&#x27;d think that exposing them to serious profanity would violate some countries laws and put HN at grave legal risk.
评论 #7943915 未加载
评论 #7947953 未加载
seanhandleyalmost 11 years ago
Brilliant, though shame it&#x27;s regarding entry to the Israeli military.
评论 #7944245 未加载
评论 #7943850 未加载