What's wrong with my new Brainfuck add-on program?
I've been working on this programming challenge: http://www.codeabbey.com/index/task_view/summing-up
It basically says:
Input data has two values A and B in the single line.
Output should have the sum A+B printed into it.
Additionally after the stop the program should have values A, B, A+B in the cells 0, 1 and 2 respectively.
So, for example, the input would look like this:
9 26
Now I think I don't understand the problem or solution because I believe the solution should be 9 26 35
where 9, 26 and 35 are in their own cells.
My solution returns 9 26 35
and I believe in the correct cells (0,1 and 2), but I am wrong. Can anyone look at the problem and my code and tell me where I am going wrong?
code:
;:>;:><[-<+>]<:
source to share
I tried connecting this to the online translators password with brain stubbornness. There is one of them here:
and more here:
http://esoteric.sange.fi/brainfuck/impl/interp/i.html
In both cases, I need to slightly change my character set ->: becomes. and; becomes,
The output from both parameters was
9 Y
Note that 35 - 9 = 24, and Y is the 24th letter of the alphabet. I think you are printing the number "35" and interpreting it as a letter.
I would try changing the program so that your output is literally single digits of the answer, i.e. outputted 3 and then outputted 5 instead of outputting the numeric "35" (but leaving the numeric value in cell 2 at the end). In other words, your text output should be a formatted version of the values ββin memory, not just output numeric values ββdirectly.
source to share