Reply to comment

The 'correct' way to write in brainfuck

If you haven't heard about it, Brainfuck is one of those esoteric programming languages. When one is learning a language, it's customary that the first program they write simply outputs "Hello World". They then usually go on to do more complex things. Not so for Brainfuck, in which simple output is an exercise in reading an ASCII table and learning how to multiply with loops and pointers. This usually leads to long strings of things like ++++++[->+++++<]>, which are a pain in the ass to type out.

A wild python script appears.

  1. import sys
  2.  
  3. text = str(sys.argv[1])
  4. for letter in text:
  5.         ascii = ord(letter)
  6.         print "[-]>[-]<","+"*10,"[->","+"*(ascii/10),"<]>","+"*(ascii%10),"."

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

More information about formatting options