Brainfuckアルゴリズム(代入、加算)

代入のアルゴリズム x = y
<セルの配置>
cell1 : y
cell2 : x
cell3 : temp
<処理>
yをxとtempに移動させる
tempをyに移動させる(復元する)

+++
[- >+ >+ <<]
>>[- <<+ >>]
<<++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++.

<行ごとの解説>
y = 3
while y<>0 {y--; x++; temp++;}
while temp<>0 {temp--; y++;}
print y
print x
print temp
print \n
※数値を表示させるときは、「0」の文字コード(48)を足す

加算のアルゴリズム x = x + y
<セルの配置>
cell1 : y
cell2 : x
cell3 : temp
<処理>
yをxとtempに加算する
tempをyに移動させる(復元する)

+++
>++++
<[- >+ >+ <<]
>>[- <<+ >>]
<<++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++.

<行ごとの解説>
y = 3
x = 4
while y<>0 {y--; x++; temp++;}
while temp<>0 {temp--; y++;}
print y
print x
print temp
print \n