,>,< input numbers at cell #1 #2
[
> go to cell #2
[
->+>+<< move data to cell #3 #4
]
>> go to cell #4
[
-<<+>> move data to cell #2
]
<<< go to cell #1
- decrement cell #1
]
>>. output cell #3
Run Code Online (Sandbox Code Playgroud)
程序读取到单元格#1,#2,结果将出现在单元格#3中
我使用BF解释器,我可以输入数字作为数字(不是ASCII符号)
小智 6
好吧,我可能没有最有效的方法,但它有效.我以特定的方式做事,以便它可以与所有这些一起工作
2*3 = 6
6*7 = 42
4*5 = 20
所以,这里是:
read
>, >, <<
convert from ascii
+++++ +
[
>----- ---
>----- ---
<<-
]
multiply
>[
>[>+>+<<-]
>[<+>-]
<<-
]
separate numbers
>[-]>+> >+++++ +++++<
[
- >- [>>>]+++++ +++++<<+
[<<<]>>>>
]
<-
<+++++ +++++>>>[-<<<->>>]<<<
convert to ascii
<+++++ +
[
>+++++ +++>
[+++++ +++>]
<[<]>-
]
print
>>[.<<]<[<<]>>.
Run Code Online (Sandbox Code Playgroud)
我用这个翻译:http://esoteric.sange.fi/brainfuck/impl/interp/i.html