Unary - Code Golf - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Hi
I see that there a a bug y the expected result in this challenge Coding Games and Programming Challenges to Code Better
This is with the string CC

Failure

Found:

0 0 00 0000 0 000 0 00 0000 0 00

Expected:

0 0 00 0000 0 000 00 0000 0 00

The C caracter is 1000011
The encoded code es 0 0 00 0000 0 00
Then, the expected is 0 0 00 0000 0 000 0 00 0000 0 00, rigth?

Check that there is no white space after the last 0.

Maybe, but, what I say is.
The first conversion expected is
0 0 00 0000 0 00
the second is
0 00 0000 0 00
How this expected result should be the rigth one?

You need to map each character to binary and then encode it as a single string. You’re currently encoding them individually and then concatenating encoded characters together.

  1. Convert individual characters to binary.
  2. Convert message to binary.
  3. Encode the new binary message.

1. C = 1000011
2. CC = 10000111000011.
3. 0 0 00 0000 0 000 00 0000 0 00
It’s looking for the encoded version of CC and not C+C.

Hope this helps!

You are the man !! Thank you very much

1 Like

I have a solution in Python that passes the tests. I have a solution in Bash that does not. However, they give the same result.
Test Alphabet and the following ones do not validate the Bash code. So I put the alphabet as custom input and the python output (validated) as custom output. My bash code pass this custom test, but not the official Alphabet test.
Any idea what’s going on?
I added a ‘echo’ to flush the output, but nothing changed.
Thanks!

One possible reason is that the input is inconsistent. The input of the earlier cases ends with a newline character, but that of the latter cases doesn’t.

That was it. Thanks!