Problem 249 Turing Increment - two bugs

Back to General discussions forum

CondorHunter     2022-03-09 18:26:54

I've developed a solution that seems airtight, but returns the text 'fail' when testing with lone 0. I traced the algorithm manually and don't see why it would have this issue. Separately, it says that returns the wrong answer for test case '011' (upon submission), but when I run the solution in the problem page it works as expected. So: did I goof or is it the checker/interpreter? Thanks!

Rodion (admin)     2022-03-09 19:12:00
User avatar

Hi! Truly behavior of interpreter looks suspicious. I'll try to figure out right now - perhaps some bug due to recent addition of 2d mode, sorry for inconvenience. Hope to get back soon!

UPD: both bugs should have gone now

Funny - the problem with 0 not accepted as input, seemingly, existed from the beginning. It's just yet another manifestation of curious php conversion because of which non-empty string containing zero is considered false. I stumbled upon this again :)

The second bug (with 011) was due to recent changes. It happened the code didn't clear tape on reloading when running several testcases. So tape gets garbage. Very silly, excuse me :) But that's one more example that one may code for years and still deliver code full of bugs, ha-ha.

CondorHunter     2022-03-09 20:07:03

Yep, that seems to have fixed it! Thanks

blue_meeny     2022-04-20 16:29:55

Hi Rodion,

No rush here, I know you have a lot more important things to deal with at the moment... and there are many other puzzles to solve here :)

Just wondering if there is still a problem with the turing machine interpretor.

With Turing Clone, problem 250...

The web page seems to give the correct answer for various inputs, but when I submit it I always get

Error for '': Undefined state reached: 0:

back from the interpretor. I am not really sure what the error message means. There is a defined state 0 in the code

I will not put the code here for obvious reasons.

regards

Phil (bluemeeny)

... and by the way, thank you again for providing a small haven of sanity in these crazy times.

Rodion (admin)     2022-04-20 19:50:54
User avatar

Dear Phil, Hi!

Sorry - this definitely is yet another unlucky bug (when rewriting the thing to work in 2D, forgot to rewrite tape initialization in specific case when it is empty - that's was meant by Error for ''... - regretfully errors reporting is so rudimentary I myself got somewhat puzzled at first).

Should be fixed now!

No rush here, I know you have a lot more important things to deal with at the moment

Oh, why, no worry :) just recently come from my single class in a week in the school. Getting myself together after dealing with these wonderful "kids" :)

And definitely I'm much interested in making this Turing task set more convenient and perhaps popular :) So thanks a lot for your report!

thank you again for providing a small haven of sanity

Thanks too for your kind words - hopefully we won't be branded as "coding escapists" or something alike :)

moxieman     2024-01-12 04:26:10
User avatar

Hello,

It looks like the bug being described here may be still ongoing. Indeed the "Run it" button appears to be giving correct answer outputs, but after pressing "submit" it will say "Expected output: Error for '1': Undefined state reached: 1:" or something along those lines. It appears that all problems with the tag Turing might be experiencing this bug as well...

Rodion (admin)     2024-01-12 15:57:20
User avatar

I may have forgotten something, but in this case it is a flaw of your code probably :)

but after pressing "submit"

when you submit the code, it is checket against several various inputs, which are hidden from you.

with one of such inputs your code fails in this way. it may be a bit unclear, but you get into state with q=1 and the current cell on the tape not being filled with either 0 or 1. Unless I'm mistaken.

qwerty     2024-01-12 19:36:04

moxieman, after your post I tried to solve this task, and solved it without problems... But I noticed there is one very tricky edge case, which may be your problem. I'm not sure I can disclose this edge case without permission, so I leave it for you to figure out possible edge cases.

moxieman     2024-01-12 20:58:59
User avatar

Thanks for the help all. After a bit of trial-and-error I was able to figure out what the different error messages were being given and figure out what my code was doing wrong.

qwerty I believe you were right that that 'edge case' was causing the issue. I was getting concerned since the "Expected answer" field was giving an error message instead of showing the actual expected answer, but I suppose doing that would have made that case too obvious...

I was getting very confused by the error messages, but I see now that Wrong output for [input]:[output] means that the code successfully finished executing, but for the given [input] I supplied the wrong [output].

Whereas the error Error for [input]: Undefined state reached: [state]:[value] means that for the given [input] somewhere the state q=[state] a=[value] was reached and that case isn't listed in the code provided.

Makes sense now!

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