Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
-
I think you should format your output with some newlines. And maybe add a unit test.
-[--->+<]>-------.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<
]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[->+++<]>+.++.[->+++++
+<]>.+[->+++<]>.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[
->++++<]>+.-----.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<
]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<
]>.++[--->++<]>.-------.[--->+<]>---.[---->+<]>+++.--[->++++<]>+.----------.++++
++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------. -
srivmanu1535yRick roll here. That's what I didn't expect.
I would still say "Spanish Inquisition" in the place would have been a better text. -
@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.
-
@bittersweet no that kind of pweny work is for peasants like you, I am writing the next Google in brainfuck
-
@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.
Related Rants
-
sam21s8• Manager : WTF did you push, now it keeps crashing all the servers. • Me : (silent, I'm trying to speak ...
-
akifarfien4We accept that the brain is the most important organ, but really, what organ is telling you that? Fucking Bra...
-
BambuSource14My girlfriend has these :D (called Code:Deck - available here https://varianto25.com/playing-card...)
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/
rant
brainfuck