sch*_*t94 4 loops esoteric-languages brainfuck
如何在 Brainfuck 中使用循环打印从 1 到 10 的数字?甚至有可能吗?
我正在寻找解决此问题的方法。
+++++++++++++++++++++++++++++++++++++++++++++++++ Cell 0 to '1'
>++++++++++ cell 1 to '\n'
>+++++++++ cell 2 to 9 as counter
[ Print numbers 1 to 9
<< Data pointer to cell 0
.+ Print and increment cell 0
>. Data pointer to cell 1 and print the newline
>- Data pointer to cell 2 and decrement counter
] Loop till counter is 0
+++++++++ Set cell 2 to 9
[ Set cell 0 to '1'
<<- Data pointer to cell 0 and decrement
>>- Data pointer to cell 2 and decrement counter
] Loop till counter is 0
<<. Data pointer to cell 0 and print '1'
-. Decrement cell 0 and print '0'
>. Data pointer to cell 1 and print newline
Run Code Online (Sandbox Code Playgroud)
+++++++++++++++++++++++++++++++++++++++++++++++++>
++++++++++>
+++++++++[<<.+>.>-]
+++++++++[<<->>-]
<<.-.>.
Run Code Online (Sandbox Code Playgroud)
1
2
3
4
5
6
7
8
9
10
Run Code Online (Sandbox Code Playgroud)
Brainf**k 打印 1 到 10
Brainf**k Visualizer