Brainfuck, despite its name, is actually a pretty interesting programming language. Sure it's esoteric. Sure you won't build a whole CRUD app in it. Sure you won't probably ever do anything useful in it. However there are some cool mental exercises you could do.
Brainfuck is all about manipulating simple numbers. The permitted operations are so simplistic, things as simple as multiplications took me some time to understand.
Here's how you multiply 3 by 5:
+++
[
>
+++++
<
-
]
Or more simply:
+++[>+++++<-]
The code itself is pretty self-explanatory, however I should warn you I had to read it a few times before I could understand it.
Today's exercise is simple, and based on the same principle as above:
1- Move a number from byte 1 to byte 2.
2- Copy a number from byte 1 to byte 2.
The second one may be a bit trickier, but once you actually find the solution, the feeling of accomplishment is so cool, you won't believe what you just did :)
I strongly recommend this exercise to people who enjoyed math riddles and quizzes at school. No prior knowledge of programming is really necessary. Just take your time.
Extra ressources
If you're unfamiliar with Brainfuck, you can check the rules in
our previous exercise. A good way to start is to actually write your own interpreter.
If you don't want to write your interpreter, try to download one, there are thousands available. You can
use mine. It's not perfect but it works.
3rd Question
If you successfully manage to do the first two questions, than this one should be easy for you:
3- Write an program that asks the user for two numbers and then multiply them