Problem 168 Caesar meets BF

Back to General discussions forum

Mister_Ed     2018-03-14 10:33:29

Hello,

could somebody please tell me how the comma operator in Brainfuck works?

I tried to solve problem 168, but the answer is wrong. On my Windows-PC I get the correct answer!

Code:

,#---------- ---------- ---------- ---------- ------ [$.

  • omitted -

,#---------- ---------- ---------- ---------- ------ ]

The program reads one character ahead and the following characters within the loop. As I said this works perfectly well on my PC, but the checker says that the program tries to read more characters than are there. When I omit the last but second line there is a stackerror on my PC, but the checker just says, that the answer is wrong.

Quandray     2018-03-14 13:17:05
User avatar

When I use the code that you submitted, on the problem's page, with the example data, your code just produces "U".
"comma" takes one character from input and puts its ASCII code to the current memory cell.

Mister_Ed     2018-03-14 15:52:42

Thank you for the quick response. I tried again, this time copying the code more carefully - and it worked!

Maybe the first time I included a semicolon from the C# source?!

Anyway it's solved now.

Thanks again

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