Wrong result for input 9 0 1 Task 119

Back to General discussions forum

ivan.e.merkulov     2021-12-19 19:03:20

Dear Friends,

my code:

,>,>,>,>,   
<--------[->-->++<<<--<<-->>>] c1:c2=space:c3=f0:c4=empty:c5=f1:c6=48
<<<[ 
>>>> c1
[-<+>>>+<<]<<[->>+>>+<<<<] /*c3=empty:c4=f1:c5=f0:c7=f1&f0*/
>
[<+>>+<-] /*c3=f1:c4=empty:c5=f0&f1*/
>>> c7
>>++++++++++ c9=10
<< c7
[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<] c11 c10=result 
>[<+>-] from c8 to c7
>[-] clear c9 
>>
[++++++++++++++++++++++++++++++++++++++++++++++++.[-]]
<
++++++++++++++++++++++++++++++++++++++++++++++++.[-]
<<<[-]
<<<
<<.<-
] 

Your input data:6 0 4

Your answer was:4 8 12 20 32 52

Expected answer was:Wrong result for input: 9 0 1

At https://www.tutorialspoint.com/executebrainfkonline.php

With input: 9 0 1

Result: 1 2 3 5 8 13 21 34 55

How to dig?)

TestUser     2021-12-20 20:09:40
User avatar

Ivan, Hi!

At https://www.tutorialspoint.com/...

I think it's better to use interpreter built in into this site. I remember this surprisingly poorly, but hopefully it is the same or close to one used for checking your solution :)

I copy-paste your solution to "Solution" field when viewing the problem, then I put 9 0 1 into "Input" field and click Brainf**k button below. Result is

0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 0 5 0 0 0 0 0 8 0 0 0 0 0 13 0 0 0 0 0 21 0 0 0 0 0 34 0 0 0 0 0 55

I guess you can easily track down the problem from there :) However feel free to ask for further help if needed!

PatrickQuirk     2021-12-20 23:03:59

The issue is that your code was made for the original version of Brainf%%k, while Code Abbey is using an extension of Brainf%%k. Code Abbey's extension adds two more commands: ":" and ";". This creates an issue with the comments you have in your code, which contain colons. Each colon is printing out the value of the current cell as a decimal integer, which is why TestUser found a bunch of 0s in the result. I did test your code without the colons, and it seems to work.

For more about Code Abbey's extension, see https://www.codeabbey.com/index/wiki/brainfuck

Rodion (admin)     2021-12-21 19:38:00
User avatar

Ivan, I got "summonned" here, but seemingly both Patrick and myself (as TestUser) already provided some insight :)

Please tell if anything else is unclear!

Anyway thanks for veryfing "summon" feature still works

Please login and solve 5 problems to be able to post at forum