Chuck Norris puzzle discussion


#195

I know our logs aren’t ideal but still

https://www.diffchecker.com/5zQlqR5N


#196

yes I haveone 0 more in Found and on space in Expected but why ? =)


#197

Any idea why I would get the following when I submit?

Validators

The following validators differ from the puzzle test cases to prevent hard coded solutions. This is why you can have some fails here even if all of the tests provided in the IDE have been successfully passed.

1 & 2 Fails
3 & 4 Succeeds

All 4 succeeds in the IDE


#198

Pass the test cases with “C” & “CC”. All work fine
If in custom cases I take the same test:
CC:
Binary ASCII code: 10000111000011 (Debug output)
CN code: 0 0 00 0000 0 000 00 0000 0 00 (Debug output)

But:
“Failure
Found: 0 0 00 0000 0 000
Expected: 0 0 00 0000 0 00”

I’m confused.


#199

How long is each binary you print?


#200

Yes, that was the reason. It seems to me, that binary reduced, by trimming first zeroes. Added checkin for length of binary and adding zeroes, if they absent.

All tests work fine.


#201

I have the same problem, and i don’t know why…


#202

I was stuck with the last test. But the problem was in library usage. I used to transfer byte array, extracted from utf-8, into ascii. First 3 test were ok. I got problem with '. So, turned out it was pointless


#203

i need help on this


#204

Tell us what’s blocking you.


#205

Thanks for the explanation. I noticed the problem and worked my way around it, but I didn’t understand the reason why it was like that.
Seeing my first try on the ‘%’ test didn’t work while I had passed the previous tests, I noticed something was off: my console.log returned 6 bits whereas the unicode is 8 bit.
I saw all unicodes less than 65 had a ‘00’ prefix, so I tried to prepend that. I saw that it wasn’t what was expected: they were expecting only one zero at the beginning of the string, so I accordingly changed my prefix and it worked.
Lots of trials and errors, and now the forums are helping me get a better grasp of what’s happening, I like it! :slight_smile:


#206

I can’t quite figure out what the problem with my code is for the last case. There are 8 spots where 0 got 1 or 1 got 0… Already did the filling up each char(or rather binary string) thing, there are no extra spaces(and this wouldn’t fit the symptoms either)… Seems like there is a problem no one in here had before…? I see no pattern in this
https://www.diffchecker.com/G4AVjtO4

Edit: My “it’s not the first binary string and the first char of the current binary string is not the same as the last char of the previous binary string” case did check the right position but calculated the next one (copy pasted from the regular case and didn’t change it). Reached 100% now


#207

Chuck Norris. I am struggling big time. It seems it does everything that it should, but I still get “Process timed out”. If I add symbol or space, program converts it accordingly.
100001111010001110101110001111010110100000100111011011111110010111001011010011110011
For easier reading I added comma:
1000011,1101000,1110101,1100011,1101011,0100000,1001110,1101111,1110010,1110010,1101001,1110011
Encoded message:

0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00 000 0 0000 00 0 0 0 00 0 0 00 00 0 0 0 00 00000 0 0 00 00 0 000 00 0 0 00 00 0 0 0000000 00 00 0 0 00 0 0 000 00 00 0 0 00 0 0 00 00 0 0 0 00 00 0 0000 00 00 0 00

Maybe my sorting logic is missing something that they are adding that I am not aware of.

while count < len(message):

if message[count] in punctuation:
    x = int(ord(message[count]))
    kodas += bin(x)[2:].zfill(7)
    count += 1
elif message[count] in digits:
    x = int(ord(message[count]))
    kodas += bin(x)[2:].zfill(7)
    count += 1
elif message[count] in whitespace:
    kodas += bin(x)[2:].zfill(7)
    count += 1
else:
    x = int(ord(message[count]))
    kodas += bin(x)[2:].zfill(7)
    count += 1

#208

I have a problem in Java:
I’m trying to convert “%” symbol into binary, using Integer.toBinaryString© method, where “c” is a char variable. java uses promotion to convert c to int first and then calls the conversion method. The problem is that the result is 37 and the conversion “1001010” and it should be “0100101”. This is weird because case 1 and 2 works flawless.


#209

How should i tell in java that my one is my first block and the zero just after it belongs to the second bloc?Do i need a variable for block? Should i use regex?


#210

There are many ways to solve this puzzle. Whether you need a variable for block and/or regex depends on your overall approach.


#211

Thank you! I am improving a lot with codingame, but the road is still very long haha


#212

I see your answer and for me it’s not mandatory to add a 0 at the left. When you get the input, the value are filled in char array, you just have to begin your mask test from bit 6 and not 7 as usual.


#213

Hello,

I pass all the tests in exercise mode but when I submit my code I do not pass the first two test (G and GG) but I spend the last two.

Bonjour,

Je passe tout les test en mode exercice mais lorsque je soumet mon code je ne passe pas les deux premier test (G et GG) mais je passe les deux derniers.


#214

Is there a problem during the check. Because all the test is done well and yet an error appears during the verification