Fireship · @fireship

Brainf**k in 100 Seconds

Uploaded December 10, 2021 · Length 2:10

Brainf**k in 100 Seconds

Summary

brainfuck explained in 100 seconds, a minimal esoteric programming language that challenges the status quo.

  • brainfuck
  • esoteric programming language
  • minimal language
  • programming challenge

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    brain [ __ ] a minimal esoteric

  2. 0:02

    programming language designed to make

  3. 0:03

    your brain hurt it's Turing complete but

  4. 0:05

    not designed to build actual software

  5. 0:07

    it's more like a work of art that

  6. 0:09

    challenges the status quo it was created

  7. 0:11

    in 1993 by Swiss physics student Urban

  8. 0:13

    Mueller where the goal was to create a

  9. 0:15

    language with the smallest possible

  10. 0:17

    compiler it was built for the amga 2.0

  11. 0:19

    operating system and the compiler weighs

  12. 0:21

    in at under 200 bytes a brain program

  13. 0:24

    starts with a 30,000 by one-dimensional

  14. 0:26

    array all values are initialized to zero

  15. 0:28

    then it provides a movable point that

  16. 0:30

    you can manipulate with eight different

  17. 0:32

    commands use angle brackets to move the

  18. 0:34

    pointer left or right by one cell at a

  19. 0:36

    time then increment or decrement the

  20. 0:37

    value in a Cell using plus or minus use

  21. 0:40

    a period to Output the bite at the

  22. 0:42

    Pointer's current location or use a

  23. 0:44

    comma to accept input and store it at

  24. 0:46

    the Pointer's current location and

  25. 0:47

    finally use opening and closing brackets

  26. 0:50

    to create a loop notice how brain Fu

  27. 0:52

    doesn't require silly things like

  28. 0:53

    variables functions and classes to get

  29. 0:55

    started with brain [ __ ] delete your

  30. 0:57

    operating system and install a migga OS

  31. 1:00

    then create a file ending inbf which

  32. 1:02

    stands for brain Fu any characters that

  33. 1:04

    are not the eight I mentioned previously

  34. 1:06

    will be ignored as a common at this

  35. 1:08

    point we have an array with 30,000 8bit

  36. 1:10

    numbers all set to zero to say hi mom

  37. 1:12

    we'll need to set each number to its

  38. 1:14

    corresponding asky character we can

  39. 1:16

    increment the first cell then enter a

  40. 1:18

    loop with an opening bracket for each

  41. 1:20

    iteration of the loop we'll decrement

  42. 1:21

    the current cell by five then use an

  43. 1:23

    angle bracket to move one cell to the

  44. 1:25

    right we'll increment that cell by three

  45. 1:27

    then move back to the left and close the

  46. 1:29

    loop the loop will will continue until

  47. 1:30

    the original cell goes back to zero at

  48. 1:32

    which point it will exit we now have a

  49. 1:34

    value of 103 at index one we can move

  50. 1:37

    the pointer to it increment it to 104

  51. 1:39

    then use a period to Output it that

  52. 1:41

    corresponds to the letter H in asky we

  53. 1:43

    can increment it again to get 105 which

  54. 1:45

    corresponds to the letter I now we

  55. 1:47

    continue this process of manipulating

  56. 1:48

    memory like cavemen until we output all

  57. 1:50

    the characters that we need now to run

  58. 1:52

    your code use rightclick copy and paste

  59. 1:54

    it into one of the many online

  60. 1:56

    interpreters congratulations you just

  61. 1:58

    said hi to your mom and brain [ __ ] this