I don’t understand either. I’ve written and rewritten, still get 100% on test cases and 90% on validators. I store the responses and check for disjointed answers, I change the range until a response is invalid, and i even check to see if the top-bottom is <0, and checked for unknown response. The validator that always fails for me is 02. I don’t get it. It’s way too easy for it to fail.
In test case 2,
47 too low
48 too high
Can your code process it to find a cheating in round 2?
If it does, the same principle applies to other numbers, e.g.
11 too low
12 too high
and other directions, e.g.
12 too high
11 too low
You can (and should) produce many more test cases to try it yourself.
I pass all tests but fail 6th and 7th validators. Need a clue. How can I know the conditions inside these validations?
Did you read the posts above yours? Maybe you can find the solution there.
Else, I can give you the validator.
Yes, I did. But it doesn’t help. I think just only one of the validators can help me get the situation.
Hi Thibaud,
I’m also stuck at validators (5,6,7)
If I can get one of those, it would help me.
Thx
Please read again this thread.
Let me reveal more of the secrets in this puzzle.
In my high-school Math there was a chapter “Logic”. This puzzle bases on nothing more complicated than that simple Logic lesson.
Principles
- All “cheating points” come from a statement contradicting earlier statements.
- Rules of the game are also kinds of statements (told before the game), so that a statement against the rules of the game is a contradiction.
What is Contradiction
(from my example given above)
11 too low
12 too high
After the first statement, the valid range becomes [12…100]
Statement 2 implies the valid range is [1…11]. The combination of two statements (use AND to find the overlapping range of two sets) will result in a null range. Null range is not allowed in the game, so that statement 2 makes a contradiction.
Valid range can shrink after new statements. It will never expand.
11 too low
21 too low (New valid statement. Valid range becomes [22…100])
12 too high (contradiction)
Extreme cases
(from the first sample in puzzle)
1 too high
contradiction to the rule of the game (numbers below 1 are not allowed)
Legal tricks 1 - noise
adding valid statements to the above cases. Add to the front, end, and/or middle.
11 too low
21 too low
12 too high
can become:
11 too low
21 too low
20 too low (noise, does not change the valid range)
12 too high (contradiction)
Legal tricks 2 - repetition
11 too low
12 too high
can become
11 too low
11 too low
12 too high
or become
11 too low
21 too low (added valid statement)
11 too low (repetition)
12 too high
Remember, noise can be added at the front, end, and/or middle, in multiple places.
Legal tricks 3 - different direction
All the above examples can be completely or partially reversed (reverse the sequence or reverse “high” vs “low”). The contradiction point will be different. Or there can be no contradiction at all.
reversed sequence
12 too high
11 too low
21 too low
11 too low
(After all these explanation, you should know where the contradiction is.)
All these tricks and principles are illustrated in the existing test cases with some possible combinations. Why not giving the full combination of all possibilities? Normally no puzzle can. However, you are now armed with the knowledge to take care of the rest of other unlisted combinations.
Hey, I’m stuck at validators 5, 6 and 7 as well. Regardless of reading this whole thread, I’m not able to find out why they fail…
I’d be grateful if anyone can give me a hint or provide one of these validators.
(It’s my last puzzle from category easy that I have to solve )
Yep, only the validators.
Unfortunately also java_coffee_cup’s logic lesson was not helpful. I created custom test cases for all of them and my code seems to work like a charm
After seeing the validators, I would add IDE test cases that check if the boundaries allow the highest and lowest values. For example:
Input:
1
100 right on
Output:
No evidence of cheating
or
Input:
2
99 too low
100 right on
Output:
No evidence of cheating
Hi! I also need a validator for cases 5, 6 and 7. Have to read full thread, but it didn’t help (
Did you try the two test cases I wrote? And also for the range around 0 and 1 instead of 100 and 99?
WOOHOO! It was helpful, thank you! My problem was about limits initialization: 1 and 100 vs 0 and 101
Am I an idiot or is there no mention of what the upper boundaries and lower boundaries are. The puzzles pretty easy to solve but I was confused as to why my upper limit could not be set to infinity since there was no mention of a range of numbers that correct answer could possibly be.