Chuck Norris puzzle discussion


#149

I have a problem with last test statement: Message from Chuck Norris.
This is my output and expected output:
Your output: 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 00 0 0 0 00 00 0 000 00 0 0 0 00 00000 0 00 00 0 0 0 00 0 0 0000 00 00 0 0 00 0 0 00000 00 00 0 000 00 000 0 0 00 0 0 00 00 0 0 000000 00 0000 0 0000 00 00 0 0 00 0 0 00 00 00 0 0 00 000 0 0 00 00000 0 00 00 0 0 0 00 000 0 00 00 0000 0 0000 00 00 0 00 00 0 0 0 00 000000 0 00 00 00 0 0 00 00 0 0 00 00000 0 00 00 0 0 0 00 0 0 0000 00 00 0 0 00 0 0 00000 00 00 0 0000 00 00 0 00 00 0 0 000 00 0 0 0 00 00 0 0 00 000000 0 00 00 00000 0 0 00 00000 0 00 00 0000 0 000 00 0 0 000 00 0 0 00 00 00 0 0 00 000 0 0 00 00000 0 000 00 0 0 00000 00 0 0 0 00 000 0 00 00 0 0 0 00 00 0 0000 00 0 0 0 00 00 0 00 00 00 0 0 00 0 0 0 00 0 0 0 00 00000 0 000 00 00 0 00000 00 0000 0 00 00 0000 0 000 00 000 0 0000 00 00 0 0 00 0 0 0 00 0 0 0 00 0 0 000 00 0
Expected : 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 0000 00 0 0 0 00 00 0 000 00 0 0 00 00 0 0 0000 0 000 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 00 0 0 0 00 00 0 000 00 0 0 0 00 0000 00 0 0 00 00 0 0 0 00 0 0 0000 00 00 0 0 00 0 0 0000 0 0 00 00 0 000 00 000 0 0 00 0 0 00 00 0 0 0000 0 00 00 0000 0 0000 00 00 0 0 00 0 0 00 00 00 0 0 00 000 0 0 00 0000 00 0 0 00 00 0 0 0 00 000 0 00 00 0000 0 0000 00 00 0 00 00 0 0 0 00 0000 00 00 0 00 00 00 0 0 00 00 0 0 00 0000 00 0 0 00 00 0 0 0 00 0 0 0000 00 00 0 0 00 0 0 0000 0 0 00 00 0 0000 00 00 0 00 00 0 0 000 00 0 0 0 00 00 0 0 00 0000 00 00 0 00 00 0000 00 0 0 0 00 0000 00 0 0 00 00 0000 0 000 00 0 0 000 00 0 0 00 00 00 0 0 00 000 0 0 00 0000 00 0 0 000 00 0 0 0000 0 0 00 0 0 0 00 000 0 00 00 0 0 0 00 00 0 0000 00 0 0 0 00 00 0 00 00 00 0 0 00 0 0 0 00 0 0 0 00 0000 00 0 0 000 00 00 0 0000 0 0 00 0000 0 00 00 0000 0 000 00 000 0 0000 00 00 0 0 00 0 0 0 00 0 0 0 00 0 0 000 00 0

But in console the following is printed:

Failure
Found:
"0 0 00 0000 0 0000 00 0 0 0 00 …0 00 0 0 000 00000 0 0000 00 0 0 0 00 0 0 00 00 0 0 0 00 0000 "
Expected:
“0 0 00 0000 0 0000 00 0 0 0 00 …0 00 0 0 000 00000 0 0000 00 0 0 0 00 0 0 00 00 0 0 0 00 00000”

As seen the sequence in console “Expected” is different than actual expected sequence as there appears 3 zeros and 5 zeros and that makes no sense.

My source code is this:

[ NO FULL SOURCE PLEASE ]

I know that the source has some problems that need to be resolved, but the console output is having problems.


#150

Huh. I don’t get the same thing:

Not that this is particularly helpful, but it’s at least not blatantly wrong, like the example you posted.

  • danBhentschel

#151

The checker tests your output one character at a time and stops once it finds something wrong. What you’re seeing is the expected value, truncated at the point where the mistake occurred. That’s why it doesn’t match the actual expected value shown.


#152

Just wanted to let you know what kept me stumbling around.

  • random outputs in the console, even with result success
  • an impossible expected output like 0 0 00 000 0000

it was, because i didn’t fill up the space left of chars, that are only 6bit in binary.
First I asked myself, why would I have to put something there, it makes the output incorrect, because I just decided to fill it up with a value - but it makes sense, because you need to know how many bits on char is, when you want to be able to decode it again.

cheers


#153

Yo, how do make the message to work


#155

Hello !

I have a problem in the “CC” part.
I succeed creating the code, I have the good result but the console don’t validate my answer.

u.U that’s very unfair !


Sortie standard :

0 0 00 0000 0 000 00 0000 0 00
0 0 00 0000 0 000 00 0000 0 00

CC vaut donc : 0 0 00 0000 0 000 00 0000 0 00


#156

trailing space at the end?


#157

Hi _CG_Thibaud

It seems that there is no space at the end.There is no space in my appends (excepting enter two zero) and I just did a join with space.

(I did the first question with the same method)


#158

Same here.


#159

It saying it’s found ‘Nothing’ when I’m outputting it using System.out.print (In Java). I get the correct output as well.
Standard Output Stream:
0 0 00 0000 0
Failure
Found: Nothing
Expected: 0 0 00 0000 0 0

I’m new to this site so probably missing something obvious…


#160

Please check that you are not printing an empty string before printing your final print.
In python I reproduce your error by adding a line with print() before printing my answer, or by printing a single ‘\n’ before my answer.


#161

Good idea but I don’t seem to be. Here is my full code:
[No full code please]
(Yeah it’s probably not a great solution :P)


#164

I got the problem too.


#165

36 bits in on chuck’s message it’s interpreting 3 1’s as only 2. My program is correct but the test is wrong. Anyone experienced this? Can’t complete the puzzle.

Failure
Found:  0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00000 0 0000 00 0 0 0 00 
0 0 000
Expected:  0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00000 0 0000 00 0 0 0 
00 0 0 00 

The raw input for his code (up until this point) is:

100001111010001110101110001111010111

My issue is at the end:

111 == 0 000
111 != 0 00

Not really sure what to do anymore considering I’ve manually written out the solution for this portion and my program is correct from what I can calculate. I must be missing something.


#166

The error is not at the end of your string, it’s in the middle.

Keep in mind that the referee does not show you the entire output string. It looks through your answer character-by-character until it finds a mistake, at which point it stops and shows you the output you had up until that point. The expected answer is much longer.

You can view the expected output by selecting Expert mode in settings and clicking on the 3 horizontal lines icon.


#168

Hi, thanks for the reply.

Yes I understand that this is only a portion of the expected output. I’m just not sure why at this point it’s incorrect. The last three characters ‘111’ are equal to 0 000, not 0 00.


#169

Your output looks incorrect to me. Here’s my interpretation of it:

0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00000 0 0000 00 0 0 0 00 0 0 000
  1    0000   1111    0   1    000   111    0   1    0   111 ?????   1111    0   1    0   111
  • danBhentschel

#170

can someone help me the console output keep saying i output nth in the % test case and the message from chuck that one but the previous is success


#171

I suspect that was an mistake in the cut-and paste, since the referee was also looking for those numbers… should have been 00 000, according to the test cases…

Squidward, I ran my old code in C#, javascript, and C and got the same as the referee wanted. You’ve got a logic error somewhere.


#172

Hello there,
Can someone help with the last test?.. everything worked fine but the message from chuck always show me that there is a mistake…
but i can’t find the problem…(i use java)

    String answer = "";
    String output = "";
    
    char[] messChar = MESSAGE.toCharArray();
    
    for(int i = 0; i<messChar.length; i++){
        if(messChar[i]==' ')
            answer +=" ";
        else
            answer +=Integer.toBinaryString(messChar[i]);
        
        if(answer.length()!=7){
        int missing = 7-answer.length();
        for(int j = 0; j<missing; j++){
            answer = "0" + answer;
        }
        }
    }
    
    char[] answerChar = answer.toCharArray();
    int zero = 2;
    for(int i = 0;i<answerChar.length;i++){
        
        if(answerChar[i] =='0'){
            if(zero!=0){
                if(i>0)
                    output += " ";
                output += "00 ";
            }
            output += "0";
            zero = 0;
        }
        else if(answerChar[i] =='1'){
            if(zero!=1){
                if(i>0)
                    output += " ";
                output +="0 ";
                
            }
            output += "0";    
            zero = 1;
        }
        else
            output+= " ";
        
            
        
    }
    // Write an action using System.out.println()
    // To debug: System.err.println("Debug messages...");

    System.out.println(output);