Back to General discussions forum
In the statement of problem #86, one can see a funny sentence:
Do not be afraid - it is easier to write Brainfuck interpreter itself than to write Brainfuck problems
The fun fact is that writing Brainfuck interpreter is much harder than finding a problem for such interpreter.
Do any of you have a working interpreter, for example, for Mandelbrot set? I studied around hundred of CodeAbbey solutions, and there are no working solutions which output result before time limit exceeds...
The few working solutions on internet are outside of CodeAbbey.
And I myself did not got a working solution in a week, so I think that funny sentence quoted above must be removed from problem statement, it just doesn't make sense.
P.S. By the way - tests like mandel.b can be easily generated by transpiler, for example here is one in Python
Sorry, the topic name should be "Is it possible to write Brainfuck interpreter by yourself?"
If we are talking about an efficient implementation of BF interpreter then yes, it can be hard to write.
Then again, I don't suppose that the goal of problem 86 is to make a fast interpreter.
Additionally, you have to consider that the interpreted nature of the BF entails some overhead.
I may have misunderstood what you meant though.
In my opinion, it is easier to write a working, not necessarily efficient, BF interpreter than writing solutions for problems in BF. So I agree with the key message of the 'funny sentence'. The hint is in the name. :)
I may have misunderstood what you meant though
I meant an optimizing interpreter. For example, given code ;[-]:
and input 999999999
, an optimizing interpreter will output 0
in a blink of eye, but 99.9% solutions here won't output anything in years...
In my opinion, it is easier to write a working, not necessarily efficient, BF interpreter than writing solutions for problems in BF.
Sounds like you write solutions for Brainfuck problems by hand, but it is much easier to write a Brainfuck code generator and generate code automatically, than to write code by hand or write a good Brainfuck interpreter.
Sounds like you write solutions for Brainfuck problems by hand: Correct, for me personally that was the spirit of the BF problems here on this site. And I am not planning to do any more BF problems any time soon. :) Also, I would argue that writing a good BF code generator might well be as challenging as writing a good BF interpreter.
I meant an optimizing interpreter
Isn't an overkill for the task? It's a good challenge but not the point of the aforementioned problem.
For example, given code ;[-]: and input 999999999, an optimizing interpreter will output 0 in a blink of eye, but 99.9% solutions here won't output anything in years...
Hm, mine finished in a few seconds. Guess my solution goes into that 0.1%? :) Just kidding.
Sounds like you write solutions for Brainfuck problems by hand
I thought that was the point.
but it is much easier to write a Brainfuck code generator and generate code automatically
I actually thought about something similar. By that I mean making some sort of language that would compile into i4004
assembly.
Hm, mine finished in a few seconds. Guess my solution goes into that 0.1%
I just did not type enough nines for C++, which is much faster than Python :)... But I think you got the idea.