20

What do you all think about my first ever brainfuck program?
________________________________________________

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

EDIT:
In case you want to run it, here's a link:
https://copy.sh/brainfuck/

Comments
  • 8
    @-red fuck your brain it does, brain fuck it's called
  • 12
    Haha, nice...

    Since you can't easily copy the code: https://copy.sh/brainfuck/...
  • 4
  • 5
    Rick rolled again
  • 1
    It fucked my brain
  • 1
    It’s ugly as hell...

    You did perfectly
  • 0
  • 7
    I think you should format your output with some newlines. And maybe add a unit test.

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

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

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

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

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

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

    ++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------.
  • 1
    Rick roll here. That's what I didn't expect.
    I would still say "Spanish Inquisition" in the place would have been a better text.
  • 1
    @bittersweet wow, that's quite nice
  • 1
    @hamolicious The real challenge is to write a program *in brainfuck* which takes any string as input, then generates the brainfuck code which would print that string as output.
  • 1
    @bittersweet that'll be my next one, going to be a challenge but it'll be fun
  • 0
    @hamolicious After that could you port the Tensorflow SDK?
  • 2
    @bittersweet no that kind of pweny work is for peasants like you, I am writing the next Google in brainfuck
  • 1
    You have a typo in variable name at line 5.
  • 0
    @NoToJavaScript Brainfuck has no variables, except for an anonymous finite-sized list, which is usually initialized as 30k elements of 8 zero bits.

    The first letter we want to print is an uppercase N.

    Let's use element 1 of our "tape" as a loop counter, and element 2 as the output.

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

    Means:
    - Decrease ptr1 by 1, from 0x00 to 0xFF
    [ start loop (it loops because ptr1 is nonzero)
    --- decrease trice more
    > move to ptr2
    + set ptr2 to 0x01
    < move back to ptr1
    ] end loop, jumps back because ptr1 is nonzero

    Using that [ loop ] is basically a brainfuck shorthand trick for integer division, 0xFF / 3 = x55, we're increasing ptr2 by one third of a full byte: For every three iterator countdowns, we increase our value by 1.

    In ASCII, 0x55 is an uppercase U, the closest we can quickly get to. So after the loop we do 7 more minuses, to get to 0x4E, which is an uppercase N.

    Period is output, comma is input. That's all there is to Brainfuck, it's actually a very easy language.
  • 3
    @bittersweet I believe @NoToJavaScript was making a joke
  • 1
    @hamolicious throw new HumorException()
  • 1
    Got my head so fucked it rick-rolled me.
Add Comment