I would like to congratulate readers of the blog happy New Year. But not just like that, but writing a greeting on Brainfuck.
The first greeting displays the message in the form of ASCII-Art.
')
Because To output the text, a limited dictionary of 5 characters was used, including a line break, then this very dictionary is formed at the beginning of the program, and then we move the memory pointer through the dictionary and display characters. Thus it was possible to significantly reduce the size of the program. It remains only to issue the text of the program itself in the form of New Year's greetings. The text of the resulting program can be viewed here .
Appetite, as they say, comes with eating. Having spent the first congratulations for about forty minutes, but I realized that this would not be enough for me, especially since the implementation of the congratulations turned out to be banal. Therefore, I took up the second greeting. I wanted to make an animated card. To implement the idea, we use the ESC-sequences, which allow you to turn the text screen almost into a graphic station.
The video shows the result of the program.
If you view the YouTube snowflakes when viewing, the demonstration will become even more spectacular.
Here, also at the beginning, a dictionary of symbols is formed, from which the image of the Christmas tree is displayed. Then in the center of the screen "drawn" herringbone.
Next, let's do the iridescent garland. The position of the "light bulbs" is static, so we will simply display them in different colors. Total used 7 colors. In escape codes, their numbers are in order. Therefore, each new character will be displayed in the color in the following order. Upon reaching the senior number, we start the numbering from the beginning. If we start outputting the “lights” of the garland by moving the color number by 1 from the previous cycle, we get the effect of running lights.
The text of the program is sufficiently documented not to dwell here on the detailed description of the program. View the program code here .
Ps. For those who do not have a terminal with support for ESC sequences, I recommend downloading the DosBox emulator and running a pre-compiled program there . The archive also contains a compiler for Brainfuck.
Upd . It was thought, and not to organize a mini contest within the blog “abnormal programming” for the most incredible congratulation on the New Year? The condition is only one thing - the congratulation must correspond to the subject of the blog. The winner is determined by the number of votes cast for a particular decision. There are no prizes other than universal honor and respect.