CGX Formatter puzzle discussion

For anyone else struggling with Validator 4 (Simple string of characters which must not be modified), I finally realized that only ’ and not " separates a primitive string.
Tiny oversight took me way too long, but I now have 100%!

I have completed it on all the testcases using the \s to get rid of both blanks and tabs, still can’t get 100% since it has a problem with the “Empty string of characters with spaces”. I have no idea what that can be, I’m not removing any whitespaces inside single-citations and have stripped everything else. Bug or am I missing something?

More likely that you’re missing something as thousands of players have solved the puzzle. Have you searched and read the hints and tips given above?

Hello, I am coming back to validator #9 : “Block with Spaces containig a value”.

People say that tabs should be handled, but I am not sure how.
I am removing initial white spaces from a string using trimStart()

' Content with spaces and	tabs'

//As you can see, here \t has worked

However this is not entirely what is expected when you see it fail:


' Content with spaces and tabs'


' Content with spaces and\9tabs' //9 is supposed to be a charcode here, right?

I have also tried to trim first occurrences of the tabulation


and validation of the 9th is still unsatisfied.
How is it supposed to trim ?
does this mean that expected result here should

  1. trim the tabs before the characters?
  2. Push it a tab further?

Can I please get a test case ,different than a you provided earlier please?
Regards :slight_smile:

Tabs as part of a string should be kept. Tabs elsewhere are removed.

The indentation in the output consists of spaces, not tabs.

1 Like

Hello again.
Thank you for confirming on what is correct.

Thanks to @5DN1L and community comments I was able to get those needed 5%.
If anyone is looking for a hint on "Block with spaces containing a value:

block with spaces containing a value can be presented as such:

3 //lines to input
( \t  \t
\t\t tru \te

expected output :

    true //4 spaces here

My problem was, I was trying to assemble the whole thing into one string with all the rules prior and only block with spaces didn’t do it for me.

Tip: don’t introduce this new rule because it will be tedious, Just split the common string by the ‘\n’
and then if your string does not have " ( ", " ) " or " ' ", use regex to replace all \t by the empty space

1 Like

Alright, add me to the list of the “I only get 95%” but for some reason it’s the Validator #5 that does it for me. “Empty strings of characters with spaces

I think it might be due to this:
console.log('') // yeah in Javascript
This gets a “Found nothing” and the validator fails. Or I assume that’s what it is.

My parser does the job tho, and does output the empty string but it doesn’t validate it. I’ve tried doing
console.log(result || " ")
but obviously that doesn’t satisfy it either.

Anyone can help me with this one?

PS In the process of trying all the examples in this forum I’ve fixed a bunch of unrelated issues with my code which passed all tests and validators anyway so thanks for these:

// text = " \t (  \t   ' \t ke  y  '  \t  =  \t  '  va \t lue   ' \t   )"
// text = "  t ru e"
// text = `(
//     'key'=        t
//    r      u
//      e
// )`
// text = ` ('un'=1;'deux'='TWO TWO';'trois'=null;'quatre'=true;'cinq'=false;'centvingtdeux'=122)`
// text = "     "

These are the ones that helped me fix unrelated stuff but they all render according to the rules now!

For which case do you get the “Found nothing” message? You shouldn’t be able to see any messages for the validators; you’re only shown whether you pass or fail.

Ah yeah sorry, that’s a miscommunication from my part. When I tweak my input to be text = " \t \n \n \t " for instance to test pure whitespace, I put a console.error('here', |${output}|) at the spot I do my console.log and I can see "here", || so I know it’s getting there, so the console.log(output) must be outputting an empty string, but the interface (when I run any random test, doesn’t matter, I override the input anyway) says “Found nothing” the same as if I didn’t do any console.log. Which was my assumption of something going wrong but I might be mistaken there.

PS: Let’s go with I don’t know what’s wrong with the validator, but I know for sure that tests with empty spaces, including or excluding " |\n|\t", are handled properly.

Are you referring to custom cases? If the expected output field contains an extra newline, but your actual output is (presumably correct) without the extra newline, the console will still show the error message of “Found nothing”.

For example, the code is


And the expected output contains two newline characters:


The error message would be

Found: "Nothing"
Expected: Nothing

If you need further help, you may send me a private message.

The following custom case may help those who have an issue with Validator 5 “Empty strings of characters with spaces”:


( ''      = ' '  )


    ''=' '

Apologies I am stuck at 95%.
My solution passes all the tests cases, however there is only one validator that it does not pass:

  • Validator #4 “Simple string of characters which must not be modified”.

I have tried all the tests suggested in this topic, the results seem fine. For example:

" \t ( \t ’ \t ke y ’ \t = \t ’ va \t lue ’ \t )" → ’ \t ke y ‘=’ va \t lue ’
“‘blah blah =; blah blah’” → ‘blah blah =; blah blah’

I tried a few other things too, but running out of imagination.

Would anyone have suggestions or know where I can get help?

Thank you

If you want, I can PM you to discuss what may be the issue.

1 Like

Yes please

It turns out that the cases listed in the statement and in this thread are sufficient to help Luke to pass all the validators. :slight_smile:

For future players’ reference and convenience, I’ve collected all the custom cases currently spread all over the places. You may check out my collection of custom cases. The link may expire from time to time; please leave a message here if it does expire.

Hi @5DN1L, your link is broken

Thank you for reporting. I’ve updated the link.

and thanks to you and your script, i was able to add the case for the vertical tab \v ASCII code 9 for test 14: block with spaces containing a value

1 Like

Boolean value with spaces : " true /t "
Empty string of characters with spaces : " ‘’ \t "