1
$\begingroup$

Trying to solve an interactive problem where you can guess the order of two sets of combinations. Each time you guess the interactive problem gives you two responses, the number items of the first set you've got right, and the second is the number of items you've put in the right order.

For instance it might tell you that you have:

4 horses, with 6 different riders, and you have to guess which rider goes with with horse in only 8 guesses.

Any help would be wonderful.

Thanks.

  • 0
    Is this equivalent to "cows and bulls" or Mastermind with an arbitrary number of colors $c$ and slots $s$? If so, I can tell you the solution is hard for large $c$ and $s$.2017-01-06
  • 0
    Is this the problem of Mastermind with $s$ slots and $c$ colors? If so, I can tell you the solution is hard when $s$ and $c$ are large. Also, the order-theory tag is completely inappropriate for this problem. Read the tag description. Recreational math might be a better second tag.2017-01-06
  • 0
    Right. Yes it is. I have to code the answer in python, but need to know (logically) how to solve the problem first. BTW: I think @Asaf removed the order theory for me.2017-01-06

1 Answers 1

1

There are five problems you might be trying to solve. In order of easiest to hardest, they are:

  • Find a decent guessing algorithm, that will give nearly the best worst-case guess number, and nearly the optimal expected number of guesses if the opponent randomly selects one color for each slot (with repetitions allowed, of course). This problem is easy: For each possible guess, evaluate the "entropy" as the sum of the $n_i \log n_i$ where $i$ ranges over all possible answer to that guess and $n_i$ is the number of solutions remaining possible if answer $i$ is received. Let's call this the basic entropy algorithm.

  • Determine the minimum number of guesses required to be sure of solving the $c$ color, $s$ slot game, and specify an algorithm that achieves that number. This is harder; the basic entropy algorithm does not necessarily have the minimum worst-case number of guesses for every $(n_c,n_s)$ pair, since you can imagine leaving a position where there is no good way to make rapid progress. However, I suspect the basic entropy algorithm does, in fact, achieve the smallest worst-case number of guesses; but it is hard to prove that.

  • Determine, for general $(n_c,n_s)$, the algorithm that yields the lowest expected number of guesses, and determine the expected number as a function of $(n_c,n_s)$. Again, this might be the basic entropy algorithm, but that would be tough to prove.

  • The hardest problem is to determine an optimal strategy mix for the actual game, in which an opponent chooses the tartget configuration and might skew the distribution toward more or fewer matching colors, so you can't count on uniform randomness. For example, in Mastermind with 8 colors and 5 slots, I generally like to have one color represented twice -- but if my opponent knows I always do that,she can exploit that knowledge. Even for 4 slots and 5 colors, this problem is utterly intractable.