[Community Puzzle] Guessing digits

https://www.codingame.com/training/medium/guessing-digits

Send your feedback or ask for help here!

Created by @Jamproject,validated by @JBM,@crashtestdummy and @Jakque.
If you have any issues, feel free to ping them.

17 posts were merged into an existing topic: Guessing digits

Tricky but not impossible.

It seems quite hard for me. I must be missing something, since my solution fails the last validator, while passing the provided test cases and anything I could come up with.

Hello,

The problem seems insufficiently explained. What happens during a round? Each player gives a pair of digits? Does that mean the number of rounds necessary is the maximum number of rounds to bruteforce the problem (because a player can give the right one first with some luck)?
Also, how can it be IMPOSSIBLE to guess a pair of digits?
Given that we know that a and b are between 1 and 9 included, the number of combinations is small (less than 81).
For instance in test case 8, the sum of digits is 11 and the product 24.
Possible combinations to get a sum of 11: (6,5) (7,4) (8,3) (9,2) => 4 turns
Possible combinations to get a product of 24: (3,8) (4,6) => 2 turns
But the expected result is IMPOSSIBLE, why ?
Is that a mistake and IMPOSSIBLE means that Maggie gave the wrong numbers on the paper and test case 8 is wrong?

Thank you in advance !
Cheers.

4 Likes

It’s a logical problem.

First, she asks Burt if he knows the digits from the set of equations. If there are too many possibilities, he can’t know the right answer, so he has to pass. Then, it’s Sarah’s turn to guess with her own informations.

The trick in this problem is that “passing” constitutes an important information for the other player.

IMPOSSIBLE means that they can guess the pair without taking the risk to fail after the rounds above.

1 Like

Hi,

My solution passes all the tests but the Validator 2 failed.

Can someone give me a clue for this validator ?

Thx

couldn’t find a useful hint to tell, so I sent you the validator.
Let us know what failed :slight_smile:

Hi _CG_Thibaud,

It’s all right, I managed to pass all the validators :grinning:

My solution was really too complicated. I wasn’t inspired…
I wrote a better one from scratch that I’ve published.

Thank you so much :wink:

P.S. : Your email was sent to an address I changed a long time ago.
Do you know someone who can fix that ?

cool news.

About the email, it’s the one related to your Discourse account, created the first time you entered the CG forum. You can change it here: Coding Games and Programming Challenges to Code Better

Provided Burt and Sarah have many possibilities to guess in the first round. Who will be the first to guess like test 3? What is the rule to guess a digit among many possibilities?

Thanks.

On each turn a player only has two possible actions. They can either say the correct digits or pass to the next player.

1 Like

I don’t quite understand the flow and the rule to make a guess. There are many possibility to guess. Which one will be chosen to guess first. Could you please elaborate about Test 3.
Given Burt has sum 7 while Sarah has product 6.
The possibilities of Burt are (1,6) (2,5) (3,4) while Sarah’s are (1,6) (2,3) that resulting (1,6) SARAH 3. What is the flow of the game.

Many thanks!

I’ve found how to change it.
My old mail was still used for the notifications…

Thx Thibaud

Given all the numbers x and y in all the tests, there is always a solution a and b for sum and product. How can some tests be IMPOSSIBLE, given that Brut or Sarah will guess many times and they will probably have it right early or late. Please any clarification

RoboStac said :

On each turn a player only has two possible actions. They can either say the correct digits or pass to the next player.

in other words, if a player is unsure of his answer, he is not allowed to respond at random.

1 Like

I don’t get why it got so many downvotes, it’s a nice puzzle.

1 Like

Continuing the discussion from [Community Puzzle] Guessing digits:

I don’t understand this task!
What mean " asks Burt if he knows a and b" - Burt try random or try find one by one…
i use to for loop but it seems to be wrong idea.
I don’t understand who find this a and b

1 Like

The name is slightly misleading as guessing isn’t allowed. They either know the exact digits or have to say they don’t know. As they both start with different information saying that they don’t know tells the other person something so at some point there is only one pair of digits or it’s impossible.

3 Likes

Example: numbers are 2 and 5
Turn 1
Burt is given 7, there are multiple combinations that give a sum of 7 so he doesn’t know which one.
Sarah is given 10, the only combination is 2*5 so she can find out.

Now, let’s consider another example where Burt is given 7. If Sarah doesn’t find the digits on turn 1, then Burt knows for sure that the combination is not (2, 5).

By filling a big chart with the history of what can be discovered at each turn, it kills possibilities turn after turn and some of them become findable at some point.

4 Likes