What is the Average Number of Guesses in a Game with Varying Step Sizes?

  • Thread starter chingel
  • Start date
  • Tags
    Game
In summary, if one number is chosen from 1 to n and a player is given the chance to guess the number by splitting the set into smaller sets, the best strategy is to halve the range at every step. This results in an average number of guesses of ##log_2(n)##. However, if the player chooses to split the sets in pieces of 1/4 and 3/4, the average number of guesses increases. A formula can be used to calculate the average number of guesses for splitting the sets into m pieces of fixed ratios at each step. Information theory can be applied to determine the number of bits of information gained per guess and the total information gained, with the average number of guesses being equal to
  • #1
chingel
307
23
One number is chosen from 1 to n, n is large, and I want to guess that number. If I get to choose one number and then I'm told if the number is bigger or smaller, then the best strategy is to try to halve the range at every step and then the average number of guesses would be roughly ##log_2(n)##.

But what if instead of cutting the set in half at each step, I would always try to cut it in pieces of 1/4 and 3/4, how many steps on average would I take? And furthermore, if I cut it into m pieces of some fixed ratios at each step, how many steps on average would I take?

If I cut them into m equal pieces at every step, the average guesses is about ##log_m(n)##, but what about unequal pieces?

If it makes it easier to analyze, we can say that I don't pick numbers, I just split the sets and I get told in which set the number is and we can assume n is very large.
 
Mathematics news on Phys.org
  • #2
Information Theory deals nicely with this sort of question. http://en.wikipedia.org/wiki/Information_theory

If you get lucky with your 1/4 guess, that yields as much information as two 50/50 questions would have yielded. So with 0.25 probability you get 2 bits of information. But if you get unlucky, you have only reduced the search space by 25 percent. That is less than what one 50/50 question would have yielded -- less than one bit of information.

How much less? Well, if you guessed unlucky twice in a row, that would reduce the search space to 0.75 * 0.75 = 0.5625 That's still not as much as a single bit of information. If you guessed badly three times, that would be reduce it by 0.75 * 0.75 * 0.75 = 0.421875. That's more than a single bit of information. So it takes somewhere between 2 and 3 unlucky guesses to equal one bit of information.

You can extend this and reason that the reduction in search space by a series of n unlucky guesses is ##0.75^n## while the reduction in search space by a series of m 50/50 guesses is ##0.50^m##. For the reductions to be equal then there would have to be a specific ratio between m and n -- each unlucky guess is worth ##-log_2 0.75## bits. Approximately 0.415. As expected, it takes between 2 and 3 such guesses to get a single bit of information.

The same formula works out for a lucky guess as well. The number of bits of information conveyed by a lucky guess is ##-log_2 0.25##. That's 2 bits.

This is the basis of Claude Shannon's measure of information. The information conveyed, on average, by each guess is taken as the sum over all possible outcomes of the probability of the outcome multiplied by the negative log of that same probability. In the 25/75 case, that is ##-0.25 log_2 0.25 + -0.75 log_2 0.75## which comes to about 0.915 bits per guess.

The information in the answer is the ##\frac{1}{n} log_2 \frac{1}{n}## added up over all n different possibilities for a total that is simply ##log_2 n##.

So the average number of guesses is ##\frac{log_2 n}{0.915}## with the 25/75 approach.
 
  • Like
Likes chingel
  • #3
Thanks for the reply, the information theory seems to address exactly this sort of question. I haven't read about the theory before and it definitely is new and interesting, and I'll be reading more about it to get a better sense of why is information content the logarithm and why can we just take the average of the logarithms. There seems to be plenty of information on the internet about it, I'll start digging in.

I take it that for splicing it into m sets of proportions ##a_i## at every step, the average number of guesses will be ##\frac{-log(n)}{\sum a_i log(a_i)}##
 
  • #4
I agree with that formula. Average number of guesses = total information gained divided by average information gained per guess.
 
  • #5
A similar way is to notice that the logarithm of the length of the set decreases linearly. So we want to get a total of ##\log(n)##, step sizes are ##-\log(a_i)## with probability ##a_i##. It does make intuitive sense that the average number of steps for large n would be the total divided by the average gained on each step, but is there a proof for that?
 

1. How does the number of guesses affect the difficulty of a game?

The number of guesses can greatly impact the difficulty of a game. In general, the fewer guesses allowed, the more challenging the game will be. This is because the player has less margin for error and must make more precise guesses in order to be successful.

2. Is there an ideal number of guesses for a game?

There is no set ideal number of guesses for a game, as it ultimately depends on the type of game and the desired difficulty level. However, it is important to strike a balance between too few and too many guesses in order to provide an enjoyable and challenging experience for the player.

3. How can the number of guesses be used to increase replayability?

By changing the number of guesses allowed in a game, it can add an element of unpredictability and make the game more replayable. For example, if a player completes a game with a certain number of guesses, they may want to try again with fewer guesses to challenge themselves and improve their skills.

4. What are the consequences of giving an unlimited number of guesses in a game?

Providing an unlimited number of guesses in a game can make it too easy and remove any sense of challenge. This can result in the game becoming boring and losing the player's interest. Additionally, it may not accurately reflect the intended difficulty level of the game.

5. How can the number of guesses be used to teach problem-solving skills?

The number of guesses in a game can be used to teach problem-solving skills by forcing the player to think critically and strategically about their guesses. With a limited number of guesses, the player must carefully consider each one and use deductive reasoning to make the most efficient choices. This can help improve problem-solving abilities in other areas as well.

Similar threads

Replies
9
Views
2K
Replies
66
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
408
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
935
  • General Math
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
Replies
4
Views
675
Replies
2
Views
2K
Replies
51
Views
629
  • General Math
Replies
23
Views
5K
Back
Top