mircea_007's blog

By mircea_007, history, 3 years ago, In English

The case for brainfuck

Brainfuck is a widely known programming language but it lacks recognition from the competitive programming comunity. I am here to fix that.

Advantages

Brainfuck has many advantages over c++:

  1. Builtin fast i/o.
  2. Builtin O(1) time complexity (there is a finite number of states so you can either end up in a cycle or finish execution).
  3. Builtin O(1) space complexity (memory is limited to 30 000 bytes).
  4. Only 8 commands (no room for human error).
  5. You now have the power to understand any Benq source (really)
  6. Immune to hacks (except from 3000+ rated users who learn brainfuck before they can walk).

How to use

You might notice that there is no brainfuck option when choosing a language for your source code. This is no problem! You can use this C++ interpreter for brainfuck. This resource also contais a few classic examples (dfs, bfs, djikstra, Roy-Floyd etc.).

Conclusion

I thank you all for reading. Upvote for more quality content.

  • Vote: I like it
  • +146
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Brainfuck doesn't optimise for modern CPU architectures.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +49 Vote: I do not like it

    Maybe your brainfuck compiler doesn't. But that's like saying C++ doesn't optimize for modern CPU architectures when you've only tried msvc.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +44 Vote: I do not like it

      That's a lot of words to dance around the fact that your brainfuck compiler doesn't do it either.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +34 Vote: I do not like it

    But, but, brainfuck has fewer possible symbols/characters than C++, so it must be easier to optimise!!!

»
3 years ago, # |
  Vote: I like it +13 Vote: I do not like it

So when will Codeforces add Brainfxxk compiler?

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

That is nice and all, but could you link an implementation to bitset in brainfuck? That would make your code complexity O(1) * O(1) = O(0), and that would really make the case

»
3 years ago, # |
  Vote: I like it +98 Vote: I do not like it

Holy heck it works!!1!