Show pageOld revisionsBacklinksBack to top You've loaded an old revision of the document! If you save it, you will create a new version with this data. Media Files==== Brainfuck ==== (an exploration into the murky underworld of [[Computer Science]] and [[Programming Languages]]) The language 'brainfuck' knows the following commands: <html> <table cellspacing="1" cellpadding="1" border="0"><tr><th bgcolor="#dadada" ><font color="#000000">Cmd</font></th><th bgcolor="#dadada"> <a rel="nofollow" href="http://libarynth.fo.am/cgi-bin/view/Libarynth/BrainFuck?sortcol=1;table=1;up=0#sorted_table" title="Sort by this column"><font color="#000000">Effect</font></a> </th><th bgcolor="#dadada"> <a rel="nofollow" href="http://libarynth.fo.am/cgi-bin/view/Libarynth/BrainFuck?sortcol=2;table=1;up=0#sorted_table" title="Sort by this column"><font color="#000000">Equivalent in C</font></a> </th></tr> <tr><td bgcolor="#ffffff" class="twikiFirstCol"> + </td><td bgcolor="#ffffff"> Increases element under pointer </td><td bgcolor="#ffffff"> array[p]++; </td></tr> <tr><td bgcolor="#eaeaea" class="twikiFirstCol"> - </td><td bgcolor="#eaeaea"> Decrases element under pointer </td><td bgcolor="#eaeaea"> array[p]--; </td></tr> <tr><td bgcolor="#ffffff" class="twikiFirstCol"> > </td><td bgcolor="#ffffff"> Increases pointer </td><td bgcolor="#ffffff"> p++; </td></tr> <tr><td bgcolor="#eaeaea" class="twikiFirstCol"> < </td><td bgcolor="#eaeaea"> Decreases pointer </td><td bgcolor="#eaeaea"> p--; </td></tr> <tr><td bgcolor="#ffffff" class="twikiFirstCol"> [ </td><td bgcolor="#ffffff"> Starts loop, counter under pointer </td><td bgcolor="#ffffff"> while(array[p]) { </td></tr> <tr><td bgcolor="#eaeaea" class="twikiFirstCol"> ] </td><td bgcolor="#eaeaea"> Indicates end of loop </td><td bgcolor="#eaeaea"> } </td></tr> <tr><td bgcolor="#ffffff" class="twikiFirstCol"> . </td><td bgcolor="#ffffff"> Outputs ASCII code under pointer </td><td bgcolor="#ffffff"> putchar(array[p]); </td></tr> <tr><td bgcolor="#eaeaea" class="twikiFirstCol"> , </td><td bgcolor="#eaeaea"> Reads char and stores ASCII under ptr </td><td bgcolor="#eaeaea"> array[p]=getchar(); </td></tr> </table> </html> All other characters are ignored. The 30000 array elements and p are being initialized to zero at the beginning. Now while this seems to be a pretty useless language, it can be proven that it can compute every solvable mathematical problem (if we ignore the array size limit and the executable size limit). more? ) * the brainfuck archive -> http://esoteric.sange.fi/brainfuck/ * http://www.muppetlabs.com/~breadbox/bf/ Actually, it's Turing-complete even if the executable size is limited to, say, half a K of source code. See http://www.hevanet.com/cristofd/brainfuck/brainfuck.html#turing and related pages. Please fill all the letters into the box to prove you're human. Please keep this field empty: SavePreviewCancel Edit summary Note: By editing this page you agree to license your content under the following license: CC Attribution-Share Alike 4.0 International brainfuck.1181292299.txt.gz Last modified: 2007-07-12 13:30(external edit)