diff options
author | Igor <pashev.igor@gmail.com> | 2010-01-20 13:15:11 +0300 |
---|---|---|
committer | Igor <pashev.igor@gmail.com> | 2010-01-20 13:15:11 +0300 |
commit | de84782edc12c5abe3277d0f162e28fa0033c7d7 (patch) | |
tree | 512351c862e7403640b0f55e219028a96028df37 | |
parent | 8b2047a458e5a4e200c6130893a568797648b9d3 (diff) | |
download | brainfuck-de84782edc12c5abe3277d0f162e28fa0033c7d7.tar.gz |
Maximum of 2 numbers
-rw-r--r-- | max2.bf | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +# Show the maximum number + +# == Preparations == + +# input the 1st number into the 1st cell +, # |a|0|0|0|0|0| + +# copy 1st cell into the 2nd and the 5th cells +[->+>>>+<<<<] # |0|a|0|0|a|0| + + +# input the 2nd number into the 1st cell +, # |b|a|0|0|a|0| + +# copy 1st cell into the 3nd and the 6th cells +[->>+>>>+<<<<<] # |0|a|b|0|a|b| + +> # move to the 2nd cell + + + +# == Main loop == + +# decrement both 2nd and 3rd cells by 1, +# the final position depends on which number is bigger +[[->]<<] + + +# == Result == +# go to the answer +>>>> + +# show the answer +. + + |