@@levyroth Turing-complete in that, any turing machine X could be simulated, as long as we give the computer access to some M_X of memory, and t_X time. As long as you can expand the memory of the system somehow, it works well enough. Basically, instead of physical machine, when speaking of turing completeness or not, you tend to talk about hypothetical version of that machine that has Just Big Enough hard drive attached. It's a bit wacky but afaik it's still "here be dragons" type deal with memory-limited computation limits. You have busy beaver function and... Uh, that's it?
Ties in really nicely to Bjarne Stroustrup's quote (creator of C++): _"There are only two types of languages, one that people complain about, and the other that no one actually uses"_
Except the one that is complained about a ton is the most used language ( cough javascript cough python cough ), and the most appreciated one is barely ever used for anything practical lol
Got bored in highschool so I spent all year learning this language. By the end of the year, best I had was a text based tic-tac-toe where you entered a number 1-9 and it would then print the tic-tac-toe board in text. Repeat this 9 times and boom, a complete game. It was hundreds, if not thousands of lines of code to do it and very inefficient
More like the "Getting Over It" of programming, designed to be minimal, hard, with one all purpose tool and once done you are left to ponder why you did you even start.
When a bug occurs you have one chance to rewrite your code to fix it but if it happens again the next time it's run the entire codebase is deleted forever
@@PalmDevs Cow language is uninspired. It's a textual replacement of brainf*ck. I just need to replace the tokens in my brainf*ck interpreter with the Moo variants and it works. It's still fun though 🚀🚀
he picked a perfect name for a physics student creating a programming language, but he did achieve his goal for creating language with smallest possible compiler so kudos for that
One of the things you didn't have time to explain is why -5, then +3. By starting with 1, one subtraction of 5 rolls over to 252. the second slot is incremented to 3. There's a lot of modulus arithmetic going on here. After 50 more loops (51 total) your values are 2 and 153. then subtracting 5 again rolls over again to 253 (and 156 now) another 51 loops and you're to 254. another 51 loops and you're to 255. another 51 loops and you're to 0 and end. At this point the second +3 slot will have added a total of 615, rolling over after 255 each time, so the desired output is reached, 103. What I haven't yet solved is how this "start 1, minus 5, plus 3" mod 256 algorithm to produce 103 was designed. There has to be a simple approach to say "I wish for this number" and pick 1,5,3 with a calculator.
Thank you for explaining it mods because I was losing my mind. I would just do like 10 + and then have it increment 10 times in the loop go to the first cell and decrement once. But this is cool.
I didn't understand shit until I noticed that the whole 256 8-bit limit looped over when incremented or decrement at both sides of the interval lol. But that really masochistic way of inputting numbers and I'm pretty sure even assembler is more straight-foward :v
We had to program with brainfuck once in college. And trust me, it was so damn difficult to: 1. understand the language 2. not bursting out laughing everytime the professor said brainfuck
Fun fact. There is a language called Whitespace which works a lot like Brainf**k just only uses - well - whitespace characters (line feeds, spaces, tabs, qou get the point, and you can probably imagine what a file of Whitespace code looks like). A colleague of mine and I were studying at the same school as Müller (the Swiss Federal Institute of Technology). My colleague chose to code a Brainf**ck to Whitespace converter. For purely scientific reasons of course.
Until around 1:50 i thought this video is designed to f#ck your brain like some kind of illusion. But then I realized that he wasn't saying and showing some random stuff.
For about 12 microseconds, I felt the need to write an interpreter to convert a higher-level language to BF, and then I realized, wait! that's what compilers already do for machine code. Never mind!
@Kanashimi except the whole point is that a language or concept is turing complete, not a physical implementation. You're right, nothing in the real world is technically turing complete
@Kanashimi correct. I'm just saying if you want it to be Turing complete you still need instructions to go both ways because looping around to the end isn't an option
if you wonder how we got to 103 at 1:34: the first number is 1 before the loop, the second is 0, all unsigned 8-bit integers the loop is executed 205 times, it decreases the first by 5 and increases second by 3 every iteration so the first becomes (1 - 205 * 5) % 256 = 0 (allowing the loop to end), the second becomes (0 + 205 * 3) % 256 = 103
What a coincidence lol! I was learning Rust and just built a Brainf*ck compiler yesterday. I also added a new operator _$_ that simply prints out the number by interpreting it as a number instead of an ASCII codepoint. This removes a lot of clutter found in brainf*ck code.
You're going in the wrong direction. BF was invented to have as few commands as possible, and to be as hard to use as possible at the same time, while being theorically capable of doing anything. Hint: there is another version of BF with as few as 6 commands, because two of the 8 main BF commands can in fact be obtained with the 6 others. That's the way!
@@nonadqs You miss the meta-point. The language isn't meant to be used, so what's the point of adding to it? Creating a MINIMAL language that could theoretically do things IS the point, and the joke.
@@drewsarkisian9375 That said, nowadays, this - the thing OP and many other did - is what is Brainf*ck used the most as of now. That is, for people to learn the basics about compilers and to have a defined problem for training a very particular skillset and ideas. As that, I see OP's work - yes, even including the clutter-removing expansion - as an absolute win. It's not honoring the _original_ idea of the language, but it very much is honoring OP's intent with the concept.
Had to write a whole python script just to check what happened with the first letter over there, didn't know with subtractions it goes back to 255 after 0 and with additions, after 255 it goes back to 0, obviously due to overflow. def test_255(num: int) -> int: if num < 0: return 256 + num elif num > 0: return num else: return 0 def main() -> None: num: int = 1 counter: int = 0 while num != 0: num = num - 5 print(num) num = test_255(num) counter = counter + 1 print(f"Iterations --> {counter}") if __name__ == "__main__": main() ## Output: 205 So the loop runs 205 times and it adds 3 to each time leading to 615, which after accounting for the overflow leaves 103.
You can also do modular arithmetic to solve this. If k is the number of times the body of the loop runs, then 1 - 5 k = 0 mod 256. Plugging this into WolframAlpha or solving by hand, you get k = 205 mod 256, so the loop runs 205 times.
I didn't know what I wanted for christmas. You just gave me a perfect surprise. Always interested how this works, but never took the time and focus to do it myself. Thank you very much!
For those having trouble understanding how the loop works I've illustrated it: We have two cells: [0][0] ^ We're incrementing the first cell by 1: [1][0] ^ Then we enter the loop and decrement the first cell 5 times: [0][0] ^ [255][0] ^ [254][0] ^ [253][0] ^ [252][0] ^ Then we move one cell to the right: [252][0] ^ We then increment the cell 3 times: [252][1] ^ [252][2] ^ [252][3] ^ Then we move one cell to the left: [252][3] ^ Now we repeat the loop until the first cell becomes 0, both cells have to underflow/overflow several times: Add 256 when underflowing (Going below 0) Subtract 256 when overflowing (Going above 255) [252][3] ^ (Loops 50 times) [-250][+150] [2][153] ^ [253][156] ^ (Loops 50 times) [-250][+150] [3][51] ^ [254][53] ^ (Loops 50 times) [-250][+150] [4][203] ^ [255][206] ^ (Loops 51 times) [-255][+153] [0][103] When the first cell equals 0 we exit the loop You can apply these principles to all of the loops shown to find the correct values!
Me: Fine. I'll do it myself. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.
Yeah I was able to create a brainfuck interpreter in literally 20 minutes. I thought it would be a fun little challenge to work on for a few hours but didnt realize just how easy it would be.
You should do one using the pikachu language! It just uses a few words that are things that pikachu says, like "pika" There's a mission statement about it being made based on pikachu language instead of human language, to make coding more accessible to pikachus, which are an underrepresented minority in the industry 😅 So a few years ago I made a simple program with it to add 2 inputted numbers together... and found out that the online interpreter for it was treating the input as strings, and just concatenating 1+1 to get 11... but iirc multiplication worked 🤦♂️ so basically the only place I found to run it was a flawed implementation that didn't follow the official pika syntax /standard 😫
I had a school project where I had to output all the lyrics of 99 bottles of beer on the wall using brainf*ck and then give a presentation on the language. It was actually quite fun to talk about making functions that generated the brainf*ck code for me in I think perl.
That code at the end is probably "Never gonna give you up" because it looks like it would match the length of the code, considering that each letter that should be printed needs a lot of brackets and other stuff in the code.
But actually, the video says it's only outputted by a dot and you can store a value and make loops to avoind longer code too, so double dots means 2 indentical letters one after another... There's more than 50 dots there, so maybe it's a long text
Creating an interpreter for bf in any language you start learning is a fun beginner project. I had no prior experience with coding when I took a beginner class in C#. After a few lessons when we had covered how loops work I made myself an bf interpreter. The most complicated thing is how to handle the [ and ] signs correctly, but it doesn't require much knowledge in coding and it's more like a logic puzzle.
btw there are other weird languages with weird or funny names from the likelyhood of brainf**k in terms of unconventional design, that are known under the name of "esoteric programming languages", or "esolangs" for short. I would like to highlight APL (litterally an acronym for "A Programming Language", and is one of the first esolangs ever being created), the Shakesperian Programming Language (a language whose scripts can also be interpreted in a really weird play) and Piet (an image-based esolang that allows you to draw art in any place that isn't code)
When I was in school l,I actually thought why I can't make a programming language that has minimum number of symbols.... So people don't need to study a lot... Then only i came to know about this lang and understand it will be a f..Up language.
The simplest one is unary, its basically this one, but first symbol is converted to 0, the second is now 1, the third is 2 and this goes on. After you have all those numbers in order, you add a 1 before the first number and convert this huge number to unary ( basically 3 is 111, 5 is 11111, 2 is 11 and this goes on). This one has just one symbol. There is also a golfcode one (forgot the name), instead of converting to unary you dont, and there are an extreme amount of golf code langueges, one called language 1, other called language 2, and this goes on and one. if the language you are compiling is "language 12345", by compiling a empty file from this language it will compile the program with the code 12345, if the code is not empty, it will compile brainfuck.
plot twist you just wrote ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------. instead of using clever loops
Y’know what though, this is way more interesting than I thought. I may try writing in brainf**k sometime edit: wrote a brainf**k interpreter in JS (still working on the input to be portable). Super fun challenge. 10/10!
I love those 2-minute videos that explain something so simply that I can think "Oh, yeah, I totally got this. Easy as hell." as long as I don't have to actually do the thing...
This world is rapidly passing away and I hope that you repent and take time to change before all out disaster occurs! Belief in messiah alone is not enough to grant you salvation - Matthew 7:21-23, John 3:3, John 3:36 (ESV is the best translation for John 3:36) if you believed in Messiah you would be following His commands as best as you could. If you are not a follower of Messiah I would highly recommend becoming one. Call on the name of Jesus and pray for Him to intervene in your life - Revelation 3:20. Contemplate how the Roman Empire fulfilled the role of the beast from the sea in Revelation 13. Revelation 17 confirms that it is in fact Rome. From this we can conclude that A) Jesus is the Son of God and can predict the future or make it happen, B) The world leaders/nations/governments etc have been conspiring together for the last 3000+ years going back to Babylon and before, C) History as we know it is fake. You don't really need to speculate once you start a relationship with God. Can't get a response from God? Fasting can help increase your perception and prayer can help initiate events. God will ignore you if your prayer does not align with His purpose (James 4:3) or if you are approaching Him when "unclean" (Isaiah 1:15, Isaiah 59:2, Micah 3:4). Stop eating food sacrificed to idols (McDonald's, Wendy's etc) stop glorifying yourself on social media or making other images of yourself (Second Commandment), stop gossiping about other people, stop watching obscene content etc. Have a blessed day!
this looks like a nice language to use to communicate with people rather than using it to make programs, just thinking about using bf to make a simple program gives me the shivers
If you think about it, machine language is just branf**k. With the added operation of "mov" to write a value into a given "tape"(memory) location regardless of where the "head" (program counter register) actually is. And "jnz" as a macro that moves the head to a given location (using the previously defined mov), performs a check to see if it is zero (the definition of the [ ] operators) and then moved the head to either the previous location or the new provided location (another simple mov) And if we follow this mental stretch and concider machine code a superset of BF. Every single language is no more that a BF framework 😎
An interesting side effect of BF being Turing-complete is that you can assure yourself that a given programming language is Turing-complete by implementing a BF interpreter in it. Since BF was explicitly made to be a very minimalistic language, this is far easier than to do so for another Turing-complete languages, and should be far easier than a formal proof.
I've been enjoying writing in it. Ton of fun. The only annoying thing is keeping track of where the pointer is; I got around that by writing an interpreter that uses labels-- when the program starts, before it begins, the lexer converts the labels into a number of arrows. I also wrote a script to compile it into normal bf!
We programmed an interpreter in one university course for modified brainfuck language (extended by some additional operations) in VHDL. The VHDL part was pain but I actually enjoyed coding program in that brainfuck, that prints my login and then optimizing it to be as short as possible :D
I love how the 2nd to last brainf**k just completely misses with the bleep. “This has been brainfuck *bleep* -nd if you want to learn more...” Whoever’s editing this: I see you 👀
a niche game called SS13, namely the goonstation branch has a machine in chemistry where you can code it in brainfuck to automate chemical processes Boy this was helpful for understanding, thank you
I wrote some 8088 assembly where first you had to clear the screen by placing black backgeound and black foreground and then actually writing character bytes to the video memory to show it on screen and i have to use interrput hooking (was required). So I actually had to modify the interrupt vector table. As far as I see, BF looks easy in comparison
The code is less obvious than assembly. Languages try to make logic of the algorithm more understandable by humankind. While this thing makes it more confusing.
my encephalon hurts!
yay!
Oh damn you were faster than me gg!
damn! well played.
🤯 WINNER! Well done. Send me an email or slack DM with your t-shirt size and mailing address.
@@Fireship but how do you know it's him that mailing you? Small doubt 😊
One thing to add - it's not just "turing complete", it's very close to original Turing machine, so no surprise it is turing complete.
No computer is really a complete Turing machine because we don't have unlimited memory space.
@@levyroth but the language is turing complete
@@levyroth yeah but Brainfuck is just a bunch of cells with a pointer, sounds awfully close to a Turing machine
@@levyroth Turing-complete in that, any turing machine X could be simulated, as long as we give the computer access to some M_X of memory, and t_X time. As long as you can expand the memory of the system somehow, it works well enough.
Basically, instead of physical machine, when speaking of turing completeness or not, you tend to talk about hypothetical version of that machine that has Just Big Enough hard drive attached.
It's a bit wacky but afaik it's still "here be dragons" type deal with memory-limited computation limits. You have busy beaver function and... Uh, that's it?
@@multiarray2320 Technically it's not Turing complete even in theory, because the specification restricts it to 30,000 cells, not any implementation.
I tried to make a silly little program in bf and realized learning assembly would be much easier
fr doe
LOL
BRAINDUCK IS SO COOL OMFFFF
Boyfriend
Assembly doesn’t take too long to learn
Sounds promising. I look forward to the full course.
😂
Well.. this is actually all there is to it :D
😂😂😂
Savage
Udemy probably has one.
You’ll be lookin forward alright, into the dark abyss of your inner sanctum.
[ start loop
] end loop
. print value
; save value
> move cell pointer forward
< move cell pointer
backwards
- decrement cell
+ increment cell
Tnx
Where's comma (,) to input values?
And people complain it's hard to comprehend 🤣
*This is a joke. Please don't kill me
Thank you
@@thedoubledeckerhat4416Are you sure about your last 4 words🌚?
Invent a usable language and developers will complain about it.
Invent an esoteric language and it will be appreciated forever.
Ties in really nicely to Bjarne Stroustrup's quote (creator of C++):
_"There are only two types of languages, one that people complain about, and the other that no one actually uses"_
My only “popular” repo is for an incredibly shitty joke language compiler I wrote
Except the one that is complained about a ton is the most used language ( cough javascript cough python cough ), and the most appreciated one is barely ever used for anything practical lol
@mane i like it
@mane working with prototypes is more confusing than brainfuck. Like, why the hell 'this' returns me the window instead of the class?!
Got bored in highschool so I spent all year learning this language. By the end of the year, best I had was a text based tic-tac-toe where you entered a number 1-9 and it would then print the tic-tac-toe board in text. Repeat this 9 times and boom, a complete game. It was hundreds, if not thousands of lines of code to do it and very inefficient
Did python or C not exist at the time or did you just want to torture yourself?
Sounds like you're pretty proud of that achievement.
@@latermyfriend8934 he said at the end to do it inefficient... And uh, for brainfuck, that's actually pretty good.
bf is meant to hurt brains hence the name, bf
I want to Like this comment but cant. 420 likes is such a nice number to ruin
So its like the Dark Souls of programming.
More like the "Getting Over It" of programming, designed to be minimal, hard, with one all purpose tool and once done you are left to ponder why you did you even start.
Nah, Dark Souls is a rhythm game this is just fuckin blasphemy haha
When a bug occurs you have one chance to rewrite your code to fix it but if it happens again the next time it's run the entire codebase is deleted forever
Dark Souls is written in Brain Fuck
the most just thing to do is to force dark souls developers to make darksouls only using bf, that would be fun to see, justice at it's peek
as a person who did not understand a single word you said, i must say, you explained it rarther well
lol I didn’t ever expect you to cover this one
i expected this to be covered. eventually
@@CariagaXIII mooooooooMmmmooOo
I was expecting this one for april's fools
@@hugazo I am still making sure it is not April Fools
@@PalmDevs Cow language is uninspired. It's a textual replacement of brainf*ck. I just need to replace the tokens in my brainf*ck interpreter with the Moo variants and it works.
It's still fun though 🚀🚀
he picked a perfect name for a physics student creating a programming language, but he did achieve his goal for creating language with smallest possible compiler so kudos for that
nice pfp
nice pfp
nice pfp
Nice pfp
Nice pfp
One of the things you didn't have time to explain is why -5, then +3.
By starting with 1, one subtraction of 5 rolls over to 252. the second slot is incremented to 3.
There's a lot of modulus arithmetic going on here.
After 50 more loops (51 total) your values are 2 and 153.
then subtracting 5 again rolls over again to 253 (and 156 now)
another 51 loops and you're to 254.
another 51 loops and you're to 255.
another 51 loops and you're to 0 and end.
At this point the second +3 slot will have added a total of 615, rolling over after 255 each time, so the desired output is reached, 103.
What I haven't yet solved is how this "start 1, minus 5, plus 3" mod 256 algorithm to produce 103 was designed.
There has to be a simple approach to say "I wish for this number" and pick 1,5,3 with a calculator.
Translate.
Math god.
thanks i was wondering about how this works!
Thank you for explaining it mods because I was losing my mind. I would just do like 10 + and then have it increment 10 times in the loop go to the first cell and decrement once.
But this is cool.
I didn't understand shit until I noticed that the whole 256 8-bit limit looped over when incremented or decrement at both sides of the interval lol.
But that really masochistic way of inputting numbers and I'm pretty sure even assembler is more straight-foward :v
We had to program with brainfuck once in college. And trust me, it was so damn difficult to:
1. understand the language
2. not bursting out laughing everytime the professor said brainfuck
lmao
lmao
lmao
Hahahahahah
XDXDXDXDXDXDXDXD
Fun fact. There is a language called Whitespace which works a lot like Brainf**k just only uses - well - whitespace characters (line feeds, spaces, tabs, qou get the point, and you can probably imagine what a file of Whitespace code looks like). A colleague of mine and I were studying at the same school as Müller (the Swiss Federal Institute of Technology). My colleague chose to code a Brainf**ck to Whitespace converter. For purely scientific reasons of course.
god, why tf would anyone do that.
sounds like fun, ima go do it aswell
@@Revermb noooo ur gonna spend way too much time on it and then regret ever commitiong to such a monsterous project. anyways good luck
holy
is the name an omori reference/j
Is the converter written in bf or whitespace though?
Until around 1:50 i thought this video is designed to f#ck your brain like some kind of illusion. But then I realized that he wasn't saying and showing some random stuff.
You made my day =))
Ironically if you don't understand operating systems this was still 100 seconds of brainf*ck
this is what it's like to not understand tech lol
The fact that people still use blatant clickbait is shameful.
LMAOOO ME TOO! I feel so stupid 🤣
I have no idea what I just witnessed and no idea on how to comprehend it. Amazing work of art.
It all made sense when you mentioned it was invented by a physics student!
lol
As a physics student, I approve.
As readable as code written by physics majors indeed
ha! nice one lol
@@TolkiCasts lmaoooo
I feel x10 smarter after watching this video, even if I don't understand much
Dunning Kruger is that you?
0x10 is still 0
@David. ... how would 0x10 be 16
@David.
@@Japhnac He would be talking about hexadecimal 16
Notice how he didn't do the usual "if you want a full course on this language, let me know in the comments below" for this one.
@@jon-h lmao
This is a full course wdym
For about 12 microseconds, I felt the need to write an interpreter to convert a higher-level language to BF, and then I realized, wait! that's what compilers already do for machine code. Never mind!
fr
I thought the exact same thing
I think that bf could actually do with even less characters: Instead of using -, we could cause intentional overflows to reset a character.
And instead of using >, you could go right until it loops back around
@@wwsciffsww3748 Oh you're right. Since bf has a finite length (usually 30,000 bytes), that should also be possible
@@SkyyySi except I believe it is only Turing complete in the hypothetical case of having an infinite tape length
@Kanashimi except the whole point is that a language or concept is turing complete, not a physical implementation. You're right, nothing in the real world is technically turing complete
@Kanashimi correct. I'm just saying if you want it to be Turing complete you still need instructions to go both ways because looping around to the end isn't an option
Programmers: why?
Müller: why not?
As programmers with, theoretically, all the digital world at our mercy, the answer is always: Why not?
No way VSCode actually has syntax highlighting for BF.
Of course there are at least 3 extensions for exactly that, one has 9k downloads.
Syntax highlight extensions are quite easy to write, and brainfuck is like the easiest to parse, all you need are two regexes
not much to highlight
@@leoingson some people just want to see the world burn, the other 9k are smuggling lighters to the rest.
the markdown spec has it
"manipulating memory like cavemen" got me. But also very accurate.
This is much smarter and more interesting than I would originally have thought. Thanks for the video! It was insightful.
if you wonder how we got to 103 at 1:34:
the first number is 1 before the loop, the second is 0, all unsigned 8-bit integers
the loop is executed 205 times, it decreases the first by 5 and increases second by 3 every iteration
so the first becomes (1 - 205 * 5) % 256 = 0 (allowing the loop to end), the second becomes (0 + 205 * 3) % 256 = 103
why is the loop executed 205 times?
why does the first cell undergo modulus?
@@edvinsjudins1109 because on every other iteration the first cell is not zero, which is required to stop the loop
@@UQMD all the cells are unsigned 8-bit integers, so they are overflowable, e.g. 253 + 3 is actually 0 (mod 256)
256 is 2^8
omg, thanks for that! I was staring at the screen thinking about it but I just couldn't believe I was in the right path
What a coincidence lol! I was learning Rust and just built a Brainf*ck compiler yesterday.
I also added a new operator _$_ that simply prints out the number by interpreting it as a number instead of an ASCII codepoint. This removes a lot of clutter found in brainf*ck code.
For some reason, I found this hysterical
You're going in the wrong direction. BF was invented to have as few commands as possible, and to be as hard to use as possible at the same time, while being theorically capable of doing anything. Hint: there is another version of BF with as few as 6 commands, because two of the 8 main BF commands can in fact be obtained with the 6 others. That's the way!
@@ThomasGodart Stop telling people to respect the simplicity of an esoteric, joke language
@@nonadqs You miss the meta-point. The language isn't meant to be used, so what's the point of adding to it? Creating a MINIMAL language that could theoretically do things IS the point, and the joke.
@@drewsarkisian9375 That said, nowadays, this - the thing OP and many other did - is what is Brainf*ck used the most as of now. That is, for people to learn the basics about compilers and to have a defined problem for training a very particular skillset and ideas. As that, I see OP's work - yes, even including the clutter-removing expansion - as an absolute win. It's not honoring the _original_ idea of the language, but it very much is honoring OP's intent with the concept.
I have never seen a more clear explanation than this for brainf*ck. Bravo!
Idea: Service workers or caching in general, and maybe WPAs.
Written purely in brainf*ck?
@@israelssantanna What else, I'm sure it can be compiled to webassembly
*WAP
PWAs?
JSF*ck actually exists and might be more feasible
Had to write a whole python script just to check what happened with the first letter over there, didn't know with subtractions it goes back to 255 after 0 and with additions, after 255 it goes back to 0, obviously due to overflow.
def test_255(num: int) -> int:
if num < 0:
return 256 + num
elif num > 0:
return num
else:
return 0
def main() -> None:
num: int = 1
counter: int = 0
while num != 0:
num = num - 5
print(num)
num = test_255(num)
counter = counter + 1
print(f"Iterations --> {counter}")
if __name__ == "__main__":
main()
## Output: 205
So the loop runs 205 times and it adds 3 to each time leading to 615, which after accounting for the overflow leaves 103.
Thank you, I was trying to figure this out with just a calculator, heh..
@@Grimtheorist Thanks for your help guys, standing here with the calculator and a Python-script open. :')
this was the comment I was looking for, thank you!
thank you for doing the legwork - i wasn't 100% certain at first how he was able to reach 103 like that
You can also do modular arithmetic to solve this. If k is the number of times the body of the loop runs, then 1 - 5 k = 0 mod 256. Plugging this into WolframAlpha or solving by hand, you get k = 205 mod 256, so the loop runs 205 times.
I didn't know what I wanted for christmas. You just gave me a perfect surprise. Always interested how this works, but never took the time and focus to do it myself. Thank you very much!
2:00 is the funniest part in my opinion, because the bleep isn’t even. “This has been Brainfuc*”
now im willing to buy fireship pro to find more content about this language
I see a bright future for this language, 2022 trending
Because HR s are getting dummer... We have to make more apps like ticktok to get job...
There is no more content, only programs
For those having trouble understanding how the loop works I've illustrated it:
We have two cells:
[0][0]
^
We're incrementing the first cell by 1:
[1][0]
^
Then we enter the loop and decrement the first cell 5 times:
[0][0]
^
[255][0]
^
[254][0]
^
[253][0]
^
[252][0]
^
Then we move one cell to the right:
[252][0]
^
We then increment the cell 3 times:
[252][1]
^
[252][2]
^
[252][3]
^
Then we move one cell to the left:
[252][3]
^
Now we repeat the loop until the first cell becomes 0, both cells have to underflow/overflow several times:
Add 256 when underflowing (Going below 0)
Subtract 256 when overflowing (Going above 255)
[252][3]
^
(Loops 50 times)
[-250][+150]
[2][153]
^
[253][156]
^
(Loops 50 times)
[-250][+150]
[3][51]
^
[254][53]
^
(Loops 50 times)
[-250][+150]
[4][203]
^
[255][206]
^
(Loops 51 times)
[-255][+153]
[0][103]
When the first cell equals 0 we exit the loop
You can apply these principles to all of the loops shown to find the correct values!
you a real one for this, I understand it now haha
Here is another way to arrive at a similar result, except that it yields [103][0] instead of [0][103] :
>++++++++++[-]
Thanks
hey i know u
That makes a lot of sense now
Love this kind of vids! Esoteric languages are always fun, so I would love to see more videos covering them.
Damn he really did say hi mom…
This language has potential to be a successor for JavaScript.
no nonononononononoon no
JSFuck is a valid sucessor, though
What's so bad about javascript?
Every other programming language: "Hello World!"
Brain F**k: "Hi Mom"
Edit: Thanx Red Point for "pointing" that out.
It's "Brain" how did you mess it up?
@@redpoint6870 His brain really got f**ked that's why he messed it. 😆
Me: Fine. I'll do it myself.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.
great way to get into making compilers and interpreters, even as a total novice you can get something working in a single day
I remember seeing a pretty fun implementation using only c macros
From making compilers to becoming an actual brainfuckery physicist.
Yeah I was able to create a brainfuck interpreter in literally 20 minutes. I thought it would be a fun little challenge to work on for a few hours but didnt realize just how easy it would be.
You should do one using the pikachu language! It just uses a few words that are things that pikachu says, like "pika"
There's a mission statement about it being made based on pikachu language instead of human language, to make coding more accessible to pikachus, which are an underrepresented minority in the industry 😅
So a few years ago I made a simple program with it to add 2 inputted numbers together... and found out that the online interpreter for it was treating the input as strings, and just concatenating 1+1 to get 11... but iirc multiplication worked 🤦♂️ so basically the only place I found to run it was a flawed implementation that didn't follow the official pika syntax /standard 😫
This language sounds really interesting. I looked it up and it’s called Pikalang
lol
I just looked this up and literally cried laughing. Thank you for this. ♥️
I had a school project where I had to output all the lyrics of 99 bottles of beer on the wall using brainf*ck and then give a presentation on the language. It was actually quite fun to talk about making functions that generated the brainf*ck code for me in I think perl.
That code at the end is probably "Never gonna give you up" because it looks like it would match the length of the code, considering that each letter that should be printed needs a lot of brackets and other stuff in the code.
This is a wise man right here
But actually, the video says it's only outputted by a dot and you can store a value and make loops to avoind longer code too, so double dots means 2 indentical letters one after another...
There's more than 50 dots there, so maybe it's a long text
@@Mostbee I mean never gonna give you up is a long text in its full length
@@thatfriendwhomovedaway6889 Well, that's true
Executed the first few letters, it begins like "what a".
fun fact: this language is so simple that it has been recreated in a Geometry Dash level
What the hell?! 😂
But does that mean you can program inside the game?
@@Flo-rq8by No they just used the triggers
@@RinkieGeintie I mean he did create a GD programing language as well
@@alexandruracz9995 yeah thats true
Ah yes, brainfugd
Someone made this in Geometry Dash. Fucking Geometry Dash.
"Brainfugd by Spu7nix"
0:13 Urban Muller literally looks like Michael Reeves
Ye
Npesta if he had a slick back
Creating an interpreter for bf in any language you start learning is a fun beginner project. I had no prior experience with coding when I took a beginner class in C#. After a few lessons when we had covered how loops work I made myself an bf interpreter. The most complicated thing is how to handle the [ and ] signs correctly, but it doesn't require much knowledge in coding and it's more like a logic puzzle.
Things like this make me appreciate how much abstraction and normal understandable code helps our tiny little human brains
super funny how he started caring less and less about beeping out brainfuck the longer the video went on
at this point i wouldn't be surprised if another language pops out like "Holy $#!t" and fireship did a 100 second video about it
technically there is HolyC which can be understood as "Holy $#!t" if said weird
@@JustPlayerDE Is that the language used to create TempleOS?
@@softwarelivre2389 yep
btw there are other weird languages with weird or funny names from the likelyhood of brainf**k in terms of unconventional design, that are known under the name of "esoteric programming languages", or "esolangs" for short. I would like to highlight APL (litterally an acronym for "A Programming Language", and is one of the first esolangs ever being created), the Shakesperian Programming Language (a language whose scripts can also be interpreted in a really weird play) and Piet (an image-based esolang that allows you to draw art in any place that isn't code)
@@imaginaoUA-camsoquecomarrobas omg
So happy you made a video on this. It’s been one of my favorite languages for but now and is what got me into esoteric languages in the first place.
- What is the simplest programming language?
- BF, it has only six simple commands and nothing more
8
When I was in school l,I actually thought why I can't make a programming language that has minimum number of symbols.... So people don't need to study a lot...
Then only i came to know about this lang and understand it will be a f..Up language.
The simplest one is unary, its basically this one, but first symbol is converted to 0, the second is now 1, the third is 2 and this goes on. After you have all those numbers in order, you add a 1 before the first number and convert this huge number to unary ( basically 3 is 111, 5 is 11111, 2 is 11 and this goes on).
This one has just one symbol.
There is also a golfcode one (forgot the name), instead of converting to unary you dont, and there are an extreme amount of golf code langueges, one called language 1, other called language 2, and this goes on and one. if the language you are compiling is "language 12345", by compiling a empty file from this language it will compile the program with the code 12345, if the code is not empty, it will compile brainfuck.
Bro, honestly, i didn't believe that was the actual name
I'm going to forget all of this in about 20 seconds but thank you for teaching me this
Recruiter: Why you have mentioned hello world program in your resume?
Me: Sir I wrote that in BrainF**k
R: You are hired
That actually seems like a legit idea.
plot twist you just wrote
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.
instead of using clever loops
Fireship is one of the very few channels i follow to learn computers. It is very unique and fun too. Keep going and do great things ❤️
brainf**k
In computing: 🤯
In nhentªi: 💀
Y’know what though, this is way more interesting than I thought. I may try writing in brainf**k sometime
edit: wrote a brainf**k interpreter in JS (still working on the input to be portable). Super fun challenge. 10/10!
Great! Now write a JS interpreter in brainf**k ;P
Interviewer: You have 30mins to solve. Which language will you program in?
Me: _Brainfuck_
Interviewer: we need 4 wishes for this ono
I knew about Brainfuck, but this is the first time I've heard about its modern dialect, Brainfbeepk. Thank you, very informative.
In my compiler design course this was the language we had to write a compiler for. Quite a lot of fun.
i like how he completely missed censoring at 2:00
"this has been brainf%$# in 100 seconds"
@@notatallbruh2011 No, it was more like "this has been brainfuc* in 100 seconds"
Amazing timing, I was just going to start using this on a project.
I love those 2-minute videos that explain something so simply that I can think "Oh, yeah, I totally got this. Easy as hell." as long as I don't have to actually do the thing...
This world is rapidly passing away and I hope that you repent and take time to change before all out disaster occurs! Belief in messiah alone is not enough to grant you salvation - Matthew 7:21-23, John 3:3, John 3:36 (ESV is the best translation for John 3:36) if you believed in Messiah you would be following His commands as best as you could. If you are not a follower of Messiah I would highly recommend becoming one. Call on the name of Jesus and pray for Him to intervene in your life - Revelation 3:20.
Contemplate how the Roman Empire fulfilled the role of the beast from the sea in Revelation 13. Revelation 17 confirms that it is in fact Rome. From this we can conclude that A) Jesus is the Son of God and can predict the future or make it happen, B) The world leaders/nations/governments etc have been conspiring together for the last 3000+ years going back to Babylon and before, C) History as we know it is fake. You don't really need to speculate once you start a relationship with God.
Can't get a response from God? Fasting can help increase your perception and prayer can help initiate events. God will ignore you if your prayer does not align with His purpose (James 4:3) or if you are approaching Him when "unclean" (Isaiah 1:15, Isaiah 59:2, Micah 3:4). Stop eating food sacrificed to idols (McDonald's, Wendy's etc) stop glorifying yourself on social media or making other images of yourself (Second Commandment), stop gossiping about other people, stop watching obscene content etc. Have a blessed day!
@@benc589 stop baiting
@@benc589 (pinches your mouth) *S H U T .*
Best language for beginners
Awesome!
My head hurts trying to figure this out, but this helps a lot, thank you!
this looks like a nice language to use to communicate with people rather than using it to make programs, just thinking about using bf to make a simple program gives me the shivers
I'm guessing the code at the end is something like "never gonna give you up"
no it is "what a free t-shirt? be the first person to comment "my encephalon hurts!" "
"Brainf**k" counter:
0:00 = 1
0:57 = 2
0:52 = 3
0:58 = 4
1:03 = 5
1:57 = 6
2:00 = 7
2:03 = 8
Thanks for this! I've always wanted to know more about this esoteric bit of programming trivia.
Loving your videos man, keep up the good work!
I would like to see an extended version please
My brain did not hurt though I think my brain just put it in categories
Having an exam in an hour. Found the perfect video to watch!
you know, after everything i've seen so far on the internet, this is by far the best possible result i could've imagined based on the term "brainfuck"
Perhaps some day, some mysterious day, somebody will come up with a framework developed in this language.
If you think about it, machine language is just branf**k. With the added operation of "mov" to write a value into a given "tape"(memory) location regardless of where the "head" (program counter register) actually is. And "jnz" as a macro that moves the head to a given location (using the previously defined mov), performs a check to see if it is zero (the definition of the [ ] operators) and then moved the head to either the previous location or the new provided location (another simple mov)
And if we follow this mental stretch and concider machine code a superset of BF. Every single language is no more that a BF framework 😎
"manipulating memory like caveman" is the best thimg i've heard in a while, i'm actually laughing outloud
I love how the beep comes after he has spoken the word :)
how many years of experience do they want in this one now 😔
For a junior position: 5 years experience with Brainf**k, and 42 years experience with any Malbolge backend framework.
i am totally 0% sure that the next video would be *Cow in 100 seconds* :)
that was sick, i hope they add some DLC for brainfug
You can literally be 256 * 8 times faster if you just type machine code directly :D
Machine code is too high level abstraction for this!
why write machine code when you can manipulate logic ga- *ahem* transistors
This video made me laugh more than I thought it would. Good job. I can see why it's called what it is. LMFAO
It makes sense, after all, and makes you focus on logic. But, as mentioned, it's a work of art, not for ordinary usage.
it's just ASM but obscured even more lol
Had to build this in assembly for school, was quite a fun exercise.
An interesting side effect of BF being Turing-complete is that you can assure yourself that a given programming language is Turing-complete by implementing a BF interpreter in it. Since BF was explicitly made to be a very minimalistic language, this is far easier than to do so for another Turing-complete languages, and should be far easier than a formal proof.
I've been enjoying writing in it. Ton of fun. The only annoying thing is keeping track of where the pointer is; I got around that by writing an interpreter that uses labels-- when the program starts, before it begins, the lexer converts the labels into a number of arrows. I also wrote a script to compile it into normal bf!
We programmed an interpreter in one university course for modified brainfuck language (extended by some additional operations) in VHDL. The VHDL part was pain but I actually enjoyed coding program in that brainfuck, that prints my login and then optimizing it to be as short as possible :D
This video is 129 seconds (or 130 seconds before you click on it).
I feel like I've been scammed.
this was actually a pretty good and easy explanation, i might switch from c++ to ensure that i can not be fired, ever!
For a course in comp sci, we did calculations using a turing machine, little did we know, we pretty much wrote brainfuck with different syntax.
I love how the 2nd to last brainf**k just completely misses with the bleep.
“This has been brainfuck *bleep* -nd if you want to learn more...”
Whoever’s editing this: I see you 👀
this is what i imagined all programming was like before i started coding myself, something about that is intriguing to me
Not designed to create actual software...
How dare you XD
@@jon-h But can it run Crysis?
@@jannes6666 More importantly: But can it run DOOM?
Never understood why it was called like that. It's super simple and intuitive
a niche game called SS13, namely the goonstation branch has a machine in chemistry where you can code it in brainfuck to automate chemical processes
Boy this was helpful for understanding, thank you
I clicked the like button out of respect for whoever spend time learning that... but I don't want more videos about it.
Knowing that exists is enough.
i love how every beep is slightly off so it doesn't mask the word
imagine someone recreating a game like rdr2 in this language
I wrote some 8088 assembly where first you had to clear the screen by placing black backgeound and black foreground and then actually writing character bytes to the video memory to show it on screen and i have to use interrput hooking (was required). So I actually had to modify the interrupt vector table.
As far as I see, BF looks easy in comparison
The code is less obvious than assembly.
Languages try to make logic of the algorithm more understandable by humankind. While this thing makes it more confusing.
My friend has just started learning programming and I told him to start with brainf*ck because its the easiest language. I created a monster 💀