# [Community Puzzle] Guessing n Cheating

I also passed all the test but failed the validators (at first I failed 3, but then I failed only the last two).

I’d like to provide some more hints as well:

You probably have thought that Bob is doing the best possible thing and all his guesses are good guesses but this is not the case. Look at some of the test data and see how he guesses.

There are two sorts of approaches that I thought of,

1. Keep track of all possible numbers
2. Keep track of the range

I naively thought the second approach is just much simpler and efficient and went with that, but notice that because of the way Bob plays, you have to pay more attentions when changing the states.

I hope this helps others who had problems passing the validators.

(I also agree with the others that tests could have checked for some extra edge cases that the validators check, but it’s at least a good learning experience that in real problems you don’t have a comprehensive set of tests to help you spot your mistakes and even worse in reality you find out you were wrong when it’s too late!)

2 Likes

I had trouble with this puzzle like many others. I tried to solve it by keeping a range (min, max) of valid numbers. One crucial tip I would like to give to others is: Bob is not a smart player and will not always “zoom in” on the correct number.

For those that pass all test cases but fail 2 or 3 of the validations, try the following custom test case:

4
75 too high
25 too low
10 too low
20 right on

With the expected result:

Alice cheated in round 4

This was a fun puzzle, but like others have said, validation cases should not introduce new edge cases and the case I quoted above (or a similar one) should really be added to the test cases.

3 Likes

Brilliant approach. Not only you helped me pass the validators, but you taught me how to help other people. Thanks!

Try the following custom test case as well.

4
50 too low
60 too high
40 too high
39 right on
Alice cheated in round 3

Hope this helps someone !!!

1 Like

I tried both custom test cases (SylverFox’s and the one from lifetimeLearner007) but my code is still printing the correct answer.

So I still don’t know why its passing all test cases but Validator 6 and 7 not

Can you share your code with me? I’m willing to take a look.

76% here but i submitted a very messy abomination lol

thank you so much because of you I scored 100%.

Hi, I’m trying to solve the Guessing n Cheating challenge in Python3 and I can’t seem to pass the no cheating test cases, the expected answer keeps changing. Example: In case 3

print(“No evidence of cheating.”)
Found: No evidence of cheating.
Expected: Nothing

print("")
Found:Nothing
Expected:No evidence of cheating

Maybe a dot?

Thanks. Fixed the dot, got 100%. But why the “Expected: Nothing”?

Because the test case expected no full stop.

Hi, i don’t understand the test case on Guessing n Cheating challenge. When i look em up, i see an error on 4 of them, here are some example
History : 47 too low,48 too high,49 too high,50 too high,47 right on
Trouvé : Alice cheated in round 1
Attendu : Alice cheated in round 2

But if 47 is the answer, the cheat is on round 1 cause “47 too low” is a lie, “48 too high” is ok

Other example :
50 too low,52 too high,51 too low,52 too low,50 too high,53 right on
Trouvé : Alice cheated in round 2
Attendu : Alice cheated in round 3

if 53 is the right answer, the cheat is in round 2, “52 too high” is a lie

When i look manually my code is okay but the validation don’t pass for 4 test case and half the real validators. Is there an error in this challenge or is there something i missunderstood ?

As said before, you are not Bob.
You must display the first round when you have a proof Alice is cheating

1 Like

Why would it be 47? The correct answer at that point in the game could very well still be say 52, with nothing inconsistent being said yet.

The only case you can say Alice is cheating right on the first round is when she gives a number out of bound.
In every other case you need more pieces of evidence to accuse Alice

1 Like

Oh okay i think a understand, the example mislead me, i thought we were suppose to find the first lie, but we are suppose to find when he should have guessed she lied. So in the example :
3
5 too high
1 too high
2 right on

The lie is “1 too high” because it can’t be zero, not because 2 is the answer, right ?

Yes, you are right.

Hi everyone! I’m trying to solve puzzle ‘Guessing n Cheating’ and my program passes all cases exept for the last. Here is dump:

50 too low
75 too high
62 too low
69 too low
72 too high
70 too low
17 right on
Alice cheated in round 6

### Failure

Found:
Alice cheated in round 6
Expected:
Alice cheated in round 7

I don’t understand why it is 7, cause the cheating was when she said ‘70 too low’, and even the example shows us such case:

5 too high
1 too high ← round 2
2 right on