CGX Formatter puzzle discussion

Feel free to send your feedback or ask for some help here!

Hi,
Can someone give me an example input for

Boolean value with spaces
Empty string of characters with spaces

Thanks

HI,

Iā€™m stuck with the case Bloc avec espaces blancs contenant une valeur
All others test works, so itā€™s really difficult to know what is wrong in my code.
Is anyone can provide me input file for this test ?

Hi Duffy,

Check your program works as expected with a test case like: http://pastebin.com/7VKgdpDE

Thanks for the reply.
Your test case does not seems to be valid, you do not have a ā€œ=ā€ next to your ā€œ2ā€
My program output with your case : http://pastebin.com/7YzENnji
Like you can see, the output is good.
I really donā€™t know why there is only the test ā€œBloc avec espaces blancs contenant une valeurā€ which does not works.

Edit:

I tried many things but I didnā€™t find any test that does not works, so i need to find a similar test or get input file of this test to see what is wrong.

Did you check your code works with inputs containing the tab character?

11 Likes

Many thanks.
I forgot to check the tab character.
Now all works, thanks again

For his defense, I was stuck by the same problem as his, because tab character are not mentionned in the subject.

1 Like

Thanks, good puzzle to check if you can make things even more complex then they are.

After reading some information about LR/LL parsers, regular grammars, lexers and all other stuff i simply switch-cased every input character with small information on context :smiley:

So my code passes all of the Gameā€™s tests fine, but when I submit my code it only passes two of the many tests. The only two tests it passes are:

Simple digit (50 pts)
Block with spaces containing a value (50 pts)

Can anyone explain why this would be?

Iā€™m using Perl as my language, and Iā€™m obviously not scripting against a specific input or test case. Or in other words, my script should work against any valid input (and it does for all of the test cases in the puzzle).

I invite you to read this topic: Really frequently asked questions

In your case, i thinks that the tests are slightly different, so you fail to solve them. and maybe tab character.

Thanks for the response - My code handles Tab the same way it would handle Space - I use Regular Expression matching with \s which matches both Space and Tab equally.

Given that my code succeeds with every single one of the 12 different Test Cases in the puzzle (including the complex ones), I would expect more than 2 out of the 20 different Submission Test Cases to pass successfully. If it were only one or two of the more complex Submission Test Cases failing, Iā€™d totally understand that I probably missed something specific in my code. I would not expect 18 out of 20 test cases (Including the very basic tests) to fail given my 100% success rate with the Puzzle Test Cases.

Again, I understand that the Submission Test cases are slightly different from the Puzzle Test cases, but here is what you put in the FAQ:

You have a minor error in your code (roundage, etc)
This is not the case given that 12 out of 12 Puzzle Tests complete successfully and only 2 out of 20 Submission Tests pass.

You havenā€™t considered all the cases
**Again, I would expect to fail only those cases in which I did not test for them in the Puzzle test. One of the puzzle tests is ā€œBoolean Value with Spaces and Tabsā€. This Completes Successfully. The Submission Test is ā€œBoolean value with spacesā€. This Fails. I would not expect the second test to fail if the first completes successfully. **

You hardcoded
I already stated that I did not hardcode anything. It is not coded specifically to any Test Case.

1 Like

ekstrom2: There are big chances that you have been victim of a recent bug from our side.
If you get a timeout on one of your test on a input/output puzzle, the report can display wrong results (tests displayed as wrong but who can be right).
We are working on it and weā€™ll apply the fix as soon as possible.
You can still try to get a 100% (there would be no bug on report).

You should maybe check for infinite loop or time consuming operations. I think that if you remove any chance to timeout, you can have a correct report, even if you donā€™t pass all tests.

Thatā€™s more odd indeed ^^ sorry if i offended you in any way.

I think itā€™s more like something @cup_of_tea mentionned, so try submiting multiple times, sometimes it does wonders. And remove any standard error output that you may have done (this slow down a lot).

Fair enough - Iā€™ll look into whether or not I can speed things up a bit and see if that affects anything. Seems odd that it would affect the simple Submissions Test Cases, but I can understand if thereā€™s potentially a bug adding to the issue as well.

@CvxFous - You didnā€™t offend me at all. Sorry if my use of bold formatting made it seem like I was angry. It just seemed like the most straightforward way to separate my responses from the lines in the FAQ I was responding to.

Thank you both for the suggestions. Iā€™ll try to speed up the execution to see if that causes any additional Submission successes, and Iā€™ll remove any STDERR printing I might have left in. If that doesnā€™t work, Iā€™ll simply come back to this puzzle later in hopes that any server side bugs have been fixed.

I completely love this site and want to do what I can to support it, so please let me know if thereā€™s any data I can provide from my end to help you address this issue.

So the bug you mentioned, @cup_of_tea, is exactly what I was encountering. I forced my code to immediately exit and fail the current test if any kind of infinite loop was encountered, and upon submitting it, I suddenly passed 85% of the Submission Tests! It turns out one of the early Submission Tests caused an infinite loop in my code that I did not encounter in any of the 12 Puzzle Test Cases. Because that early test timed out due to the infinite loop, the bug you mentioned caused all of the remaining Submission Tests to instantly fail (regardless of whether my code would pass them or not).

Because I was now able to see exactly which Submission Tests were causing infinite loops, I was able to instantly identify the problem within my code and fix it. Within minutes I was able to get 100% on the puzzle! Now I know to look for any possible chance of an infinite loop or timeout if this ever happens again.

Thank you so much for helping me solve this issue! I was beating my head against the wall so hard trying to figure out what my code could possibly be doing to cause nearly every Submission Test to fail when I knew my algorithm was (mostly) correct. I hope youā€™re able to fix that bug eventually, but now that I know it exists, itā€™s very easy to watch out and account for.

HI. I canā€™t pass one test: ā€˜Simple key/value with spacesā€™.
Can anyone write an example input for this test?

('key'='value')

is key/value without spaces.

(     'key'    =    'value'    )

may be key/value with spaces.
or even

(     '  ke  y  '    =    '  va  lue   '    )

and try tab ā€˜\tā€™ character as well.

Thanks for examples.
I found the problem. It donā€™t pass in example like this: ' ke y ' = ' va lue '
without ā€˜(ā€™ and ā€˜)ā€™

1 Like

oops, i though i told you about this but i didnā€™t, glad you could find it :slight_smile: