How to Program in Brainf**K
Part 1 of 3:
Before you Program
- Get a brainf**k compiler. You can use compilers on the internet if you can't download one.
- Get a copy of the ASCII codes. Brainf**k converts letters and symbols into their ASCII value, and stores them in this form. You'll need to be able to look up the values for letters while you are programming.
Part 2 of 3:
Programming
- Understand how brainf**k operates. Imagine a ribbon of paper, divided into squares. The ribbon is one square wide, but an infinite number of squares long. In each square, you can put a number. Now imagine that you have a pointer (e.g. a pencil) that can point to ONE of the squares. Brainf**k can move the pointer back and forth along the ribbon, change the value in the square that the pointer is pointing to, and go around in loops.
- Understand what < and > do. The pointer is pointing to a particular square. < moves the pointer to the square before the current one. > moves it to the square after.
- Understand what + and - do. + increments (adds one to) the value of the current square. - decrements (subtracts one from) the value of the current square.
- Understand how brainf**k outputs characters. A full stop . is the output command. This reads the number in the current square, then outputs the corresponding ASCII character (this is why you need the ASCII table).
- Understand input. A comma , is the input command. This will ask you to input a string of characters. It will take the first character and store it's ASCII value in the current square, overwriting any value already there.
- Understand loops. [ is the start loop character. If the square under the pointer contains a zero when the program reaches this character, it will skip to the instruction immediately after the corresponding ] Otherwise, it will continue to the next instruction. When the program encounters a ], it will skip back to the corresponding [ Loops can be nested (placed one inside the other).
- Look at an example program. If you understand the instructions above, you should be able to figure out how it works. It will print Hello World! on the screen. ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
Part 3 of 3:
Familiarizing Yourself with the Derivatives
- Get to know the alternatives. There are many derivatives of brainf**k. Some of them add new features. Others simply replace the instructions with different words.
- Ook! is a simple derivative of brainf**k. It doesn't change any instructions, it just replaces them with ooks. Here's the translation: < = Ook? Ook. > = Ook. Ook? + = Ook. Ook. - = Ook! Ook! . = Ook! Ook. , = Ook. Ook! [ = Ook! Ook? ] = Ook? Ook! Ook! was designed to be read by orangutans (as a joke).
- Blub is another simple derivative. It's exactly the same as Ook!, just swap the word Ook for the word Blub e.g. [ = Blub? Blub! As Ook! was designed for orangutans, Blub was designed for fish.
4 ★ | 1 Vote
You should read it
- Quiz: 1 Ha (ha) in how many square meters, square kilometers?
- NASA captures a large, square-shaped piece of ice
- Why does the PlayStation button icon have a square, triangle, X and O?
- How to Enter Square Roots on PC or Mac
- The interface of Messenger messages is converted to a square and this is a fix
- How to Get Money on Square Cash
- Detecting 50 square holes of ancient houses in Sichuan, China
- Formula to calculate trapezoidal area: normal, square, weight
May be interested
- 8 tools to hide programs running on Taskbar or Traybarif you want to hide a program or application running on the taskbar for some reason, you don't know how. the network administrator will introduce you to 8 useful tools to help you hide the program in the taskbar.
- ADX Toys 2: Programming editor for Wordprogramming requires you to have a suitable program and a specific environment, plus a translation program to translate the source program. however, when you want to interpret a certain meaning content in a language, you need to write it into a text to express your meaning.
- 3 ways to end a program in Pythonknowing how to end a program is important and can be helpful in many different situations. for example, if you're creating a simple game, you can exit when a specific user enters or when a certain condition is met.
- How to join the Apple Beta program to try the latest iOS versionsapple has provided a free beta program for users (public beta), previously you need to pay 99 usd / year. and you can sign up for this apple program right now according to the instructions below.
- How to Make a Program Using Notepadthis wikihow teaches you how to use your windows computer's notepad app to create a program. to do this, you'll type a program's code line-by-line into notepad and then save the notepad file as the programming language's preferred format....
- How to Program Softwaredo you have a perfect idea for a program, but don't know how to turn it into a reality? learning a programming language takes time, but many successful programmers are self-taught. once you learn to think like a programmer and get the...
- What is Program Compatibility Troubleshooter in Windows 11? How to use it?program compatibility shooter is a windows tool that helps you troubleshoot application compatibility issues.
- Test about program structurea set of questions about the structure of the program helps readers gain more useful knowledge. invite your reference.
- Detection of development assistance program ... trojanresearch experts of sunbelt software inc. said they have just discovered a special program that they believe is used to create new keyloggers and trojans to target customers of credit institutions around the world.
- What is a PSD file? Which program to use?what is psd? what program to use? must be a question that many people are wondering. so let's tipsmake.com go find out and answer offline. psd stands for photoshop document, an image file that is saved in its original format of layer layers