Back to General discussions forum
Summing Up Problem #116
Need help in understanding the problem statement
I think , the description about the problem is not sufficient on what is expected to be performed.
When I am trying to print the sum of the two numbers -- The error comes like this.
Error: Limit of operations (100000) reached before program finished!
Is this a problem meant to be solved only with BrainFuck !!!.
Yeah mate, this problem is intended to be solved only on Brainfuck (with Python it would be too easy, don't you think?).
See, your code have the following line:
arr.append(arr[0]+arr[1])
Brainfuck interprets this line as follows:
+
orders interpreter to increment value in current memory cell - after this value of current memory cell becomes equal to 1.[
signals the start of loop.]
check the loop end condition. Because the value of current cell is 1 and is not equal to 0, program returns to previous command [
and loop continues.]
reached again, loop continues...Please refer to article Brainfuck Wiki for details.
Additionally, I took a look at problem statement / instructions and I think they are pretty clear.
You are asked to modify a Brainfuck program - obviously result should be Brainfuck program too!