Brain F**k in 100 Seconds | Prime Reacts:
Vložit
- čas přidán 14. 02. 2023
- 100 seconds of Brain F*** by non other than the GOAT himself, Fireship!
GO SUB!!
/ @fireship
Recorded live on twitch, GET IN
/ theprimeagen
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord - Věda a technologie
THE GOAT HIMSELF: www.youtube.com/@fireship
GO SUB TO HIM
Too late, already subbed
BASIC reference?
If he's impressed by the 107 byte compiler, someone wrote a Brainfuck interpreter in Brainfuck.
w...hat?
i did that, if you know the language and play around with it a ton to learn the concepts and patterns its actually not extremely difficult, i made my own interpreter and debugger
@@electricengine8407 github (or other place where code is) or didn't happen
Even BF is bootstrapped!? When will this end?
@@the-pink-hacker The end is the beginning, as the universe is bootstrapped
Brainfuck is an example of a "Turing tarpit" language, where "everything is possible but nothing of interest is easy".
Everything is possible with assembly. Even RISC assembly is a lot easier than this insanity.
Your main channel will always be my favorite, but seeing your disbelief and wonder (i.e. at the recursive main) is contagious and hilarious.
:)
it was SOOO fun to see that
I didn't even know this is the secondary channel. I thought that I was on the main channel, I just saw Prime and clicked
yeah it was definitely a W move to become active on the clips channel again
@@khalilbessaad5553 same🤣
Wait
This wasn't the main channel?
Bro i legit thought this guy only had about 50k subs
the syscall is for I/O where !b will be evaluated to an int from a bool so it will call 3 or 4 which corresponds to read and write, respectively.
You can almost feel it moving a mechanical something inside your machine with every character. I bet i could hear it with a stethoscope on an HDD.
Gold comment
It sure seems like someone could build a mechanical bf interpreter with punch card instructions
Yeah...or slowly move an oszillograph along your RAM xD
Assembly was the first language I've learned. Then I started experimenting with C. I thought functions were just like labels in Assembly, and I used a recursive main in one of my beginner C codes. My teacher told me "just don't do that".
He was being very considerate
How long are you in the industry?😅
@@aziemelzapratama5257 op has seen dinosaurs
dont let them cramp your style, recursively call main all you want
Back in college I had come up with a project related to compilers, so I submitted a transpiler that translates Brainfuck to functioning C code. The whole class was impressed, but really it takes one to know how Brainfuck theoretically works to know how easy it really is. 😂
Anything more is just unnecessary bloat. Variables are crutches.
"Variables are crutches."
- jonathan blow
Watching you get your mind blown as you read the code of a language named "brain f***" is HILARIOUS 😂
as turing intended lolol
Gotta love how Brainfuck is Turing complete, so you can technically build anything with it
ngl, the first time I saw a recursive main, my reaction wasn't any different than prime's; it's a powerful code obfuscation tactic
Saw on stream. Still watching since its so funny how mind blown you are ;)
I WAS BLOWN AWAY!!! it was such a fun experience
ChatGPT programmed a recursive main in C and I was like "Waaaaa?!?"
Love your vides, always fun to watch. This was interesting for sure. BFJS sounds like a fun project for a live stream ;)
Somehow he always found a way to shit on javascript and I love that.
You, my friend, are a extra special kind of special. Appreciate you so much =D
Only Prime can take a 2:09 minute video into over 5 minutes and still make it entertaining.
brainfuck is basically a slightly modified Turing machine. it's a good intro into computability and formal language theory
My brain hurts... 🤯
What did you do to Brian?
@@FlorianWendelborn my bad... brain was really hurting.... Lol
Your entire hard drive is a one-dimensional array of bytes. Or (galaxy brain) it’s a scalar unsigned integer with a maximum of 2^(drive size in bits).
It can be signed if you start counting the index from 1
I moved from too complex to simple: Rust -> Zig -> Brain F**k
4:33 quick brown fox jumps over the lazy dog
The ai in brainfuck video by mitxela is my favorite video out of all the ones I've seen about esoteric languages
A friend create a Linux binary interpreter with size of 380 bytes for brainf*ck :D
One of my first programming projects when i came back to programming was an Brainf**k interpreter written in C++ which i called Brainfluff.
I think such interpreters are fun project to see how an very simplistic compiler works.
I will rewrite it probably in a few days or so when i have less work.
Recursive main just blowing prime's mind #wholesome
from what i understand the loop to do. it increments or decrements a cell. once the cell hits zero the loop ends. you can move other values up and down as necessary. once value 0 becomes 0 your loop ends.
4:40 Windows PowerTools baby!
FINALY the code where regular expressions was created.
I wrote a BF interpreter once, and main recursion within a loop is the easiest way I found to code the [ and ] operators.
Great video! also I just noticed are you sitting on an exercise ball?
BF ray tracer implementation that outputs the rendered image as mono color byte array
I wonder what (double precision) floating point division looks like in this language.. it would be quite the challenge
Wow this new coding language is like rust without all the bloat
1:03
if !b does the same thing in C as in JS it would make it 0 if the number is non zero, and 1 if the number is zero, so 4 - 0 or 4 - 1 I think...
I hope Jeff recursively reacts to this video
The thumbnail is brilliant
Actually BF make quite some sense when you use it to generate code using genetic algorithms. It's pretty easy to represent it as genes and mutate it to find solutions.
If we scanned the human genome and used it to find valid brain fuck programs i wonder how many of them would actually output some fun strings. Like are there any randomly occurring words in the human genome?
I love the original, you add some nice spice and detail to it.❤️🙏 Could you do a Vim for Brainf**k brainf**k please?
That's awesome recursion is my favorite part of coding.
I wrote an interpreter for it back in college in ARM ASM, so mine came in at ~300B when assembled. Unfortunately, ARM machine code isn't super dense!
Mitxela build a full tic-tac-toe ai in bf.
Such a freaking mad man
Primeagen: Please look at sectorlisp! Could you give us a deep dive on that one? I want to learn the metacircular evaluator, the computer science equivalent of Maxwell's Equations. And sectorlisp can set up the basic LISP machine in less than 512 bytes of 8088 machine code. That's a small compiler! Almost as tiny as bf.
It's gotta be "like && subscribe"
I'd just stick to machine code. It is much easier and a 0-byte compiler 🥴
That's not a compiler that's an interpreter
The code there outputs "what a free t-shirt? be the first person to comment my encephalon hurts! "
2:15: _“Notice how Brainfuck^beep^ doesn't require silly things like…”_
Yeah, create your own language where logic makes no sense, like
null == 0; // -> false
null > 0; // -> false
null >= 0; // -> true
A language like that would be a real brainf*ck. Oh wait...Hello JavaScript my old friend.
LMAO
Hey is it what I think it is? >= defaults to the opposite result to < and that's why?
@@theodorealenas3171 oh, is that it?
@@user-sl6gn1ss8p I know Python does this, with operator overloading (but C++doesn't). If you overload what the < operator does, the >= operator will work accordingly.
@@theodorealenas3171 In C++20 you're supposed to overload spaceship so all the comparisons will work as intended
Played about some with Brain Fuck years ago. Still have a habbit of typing 'p' for '+', just from commenting code.
This is the world functional programmers want for our children.
Advent of code in Brain F****.....next year
"I dont even know what four minus BANG B means" 😂
I just learn that some people made a brainfuck compiler in brainfuck
it is time to write js framework on brainfuck
It's a rick roll for sure. The last code
Just as Turing intended :`)
i have seen a recursive main before. it works.
This is so exciting
It's not recursive, it's the Y Combinator, therefore inductive over program
Fireship is so good
> recursive main!? what?!
Just before, I watched the video that Haskell appeared in lol
(main being recursive is pretty normal there. And it's not even a function…)
Comment without any thought: Is main recursive because it's a recursive descent parser?
Doom in Brainf^&k when?
When you going to do prolog?
my encephalon hurts!
THE NAME is the Brainagen
you should react to JSF*k
you just need a transpiler from javacript to brainf*ck
has anyone figured out what the video end code does??
apparently it was "what a free t-shirt? be the first person to comment "my encephalon hurts!""
(with the typo)
the way he explained it, 5 decrements means 51 loops. how is 51*3 increments 103? Why is it not 153?
He adds one first making it 1025 so it is 205 loops which results in 615 or 512 + 103.
can someone explain the loop code of how it got 103
The first cell is used as a counter for the loop and is set to 1. For each iteration of the loop, the counter is decremented by 5. Since a cell wraps around the maximum value of a byte (1 - 5 = 252), it takes 205 iterations for the counter to reach exactly 0, which is the exit condition of the loop. The second cell is used as the character value and is first set to 0. For each iteration of the loop, the character value is incremented by 3, which makes 205 * 3 = 615. But this cell also wraps around, so the final value is 615 modulo 256 = 103.
chat GPT cant code in brainfug, what a shame.
I prefeer to program my systems with lolcode. No memory safety or fearless concurrency but lot o lols.
Recursive main... still better than JS event loop 😏
But the real question is, can we write JavaScript compiler using brainfuck? 🤔
AWS shoulkd bring BF lambda SDK for next years April fools.
This kind of video makes me want to quit programming then go open a bar
setup tour
why wouldn't there be a recursive main?
On the topic of "recursive main", function-level try-catch works on "main" in C++, so if you place a call to main inside "catch" attached to main, your code is now un-crashable by pesky exceptions!
For legal reasons, this should not be used in real code. I don't take responsibility for any consequences that may result from this practice. Try-catch safely.
DO ROCKSTAR
This compiler is interesting, the only downside to it is the writing system/syntax. If you use a different syntax/writing system on this, then it might be usable. By writing system I mean Latin/Greek/Arabic. One thing I've had a big interest in is creating a writing system from scratch but I don't have the time to do so. Think Hangul and Mayan.
❤
also: no side effects 🎉
BrainF**k is not entirely useless. I recently saw a paper by some mathematicians showing an algorithm to factorize arbitrarily large integers asymptotically optimally (that is it has the same O(f(n)) as the most efficient classical factorizing algorithm, the could not show what that was, and finding the most efficient factorizing algorithm is still an open problem), and BF was a crucial part of that algorithm. Basically what they did was a BF program, execute one step in it, then create a second program, execute two steps in the fist program and one in the second one step and then create a third program (in every iteration each program executes twice as many steps as in the previous iteration), and so on until one of all the programs they created spits out the correct factorization of the large integer that was given (which is easy to check since multiplication is polynomial in the number of bits in the integer). They actually wrote a python program that did this, (it was excruciatingly slow, it took several days for it to factorize 4). The point is that Brainfuck is not completely useless.
I wonder what made Brainfuck helpful for this problem vs using assembly?
@@hereandnow3156 brainf**k is extremely simple to implement while most assembly languages are way more complicated. In a way brainf**k is a very simple form of assembly.
Skill issue for all of us :D
There is actual language called JSFuck.
four minus bang bee
JSFuck DOES EXIST!
I prefer JSF*CK, it's more portable
😂 same!
Still better than *JavaScript*
His Javascript for the Haters video is really funny.
5:30 why not just write it in binary then.
Binary is actually a more complex programming language.
@@cherubin7th Binary isn't a programming language.
Yeah, thats a really good question, i'm not sure whats so impressive about BF. With the amount of brainpower needed to write BF, you might as well look up the ISA and do some translating. The real "programming language" with the smallest compiler is the machine code, which is zero.
@@derrheat154 It's cool because it forces you to realize how genius Turing was for figuring out that the tape model allows for all computations
I did write a brainfuck interpreter lmao when I was experimenting with compilers.
syscall hack is cool, recursive main is sublime
We should subscribe to you too😂😂