Hello,
I’ve already written in a similar topic -> here but it’s a slightly different subject so I create a new topic here.
As I said in the topic linked above, I can’t pass the Validator 8 for the community puzzle “Organic Compounds” (here).
But my solution passes all the IDE tests and I really can’t say what is going wrong with that validator.
Has anyone some ideas?
Thanks!
EDIT: solved!
The Test 8 was supposed invalid because the bond near CH3 was 2 instead of 1.
I modified my input to write 1 instead of 2 and I was expecting for my program to return “VALID”.
But it did not! It was still writing “INVALID”, which was incorrect.
My error, I think, is pretty specific to my solution, so I guess it will not help many of you, but I can explain a bit. For each molecule, I was looking for a bond at its left, at its right, at its top and at its bottom, and checking that the sum was exactly 4. It turns out, when I was looking for the bottom bond, I sometimes skipped a line! And for that test 8, by chance, it still worked.