Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For those wondering what the program does:

TL;DR - The program writes a Brainfuck program that writes the text you inputted. Pretty neat

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 "A" 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.

So if you run the code extracted from the letter:

    +++++++++[<+++++>-],[[-<--.++<+>>(]<+.-<[->.<]>>,]
If input an 'A' the output is:

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----------------------------------------------------------------
which if run returns an 'A'

Online interpreter - http://nayuki.eigenstate.org/page/brainfuck-interpreter-java...



Hmm...

It would be interesting to do something similar, but optimizing for output code size.

For example, I'm pretty sure that the following is one of the shortest representations of "A" in BF, although it doesn't clean up after itself.

    -[+>+<[+<]>]>+.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: