Spades and fixed - find the right $4-digit$ number in $6$ questions or less.

42 Views Asked by At

I'm currently building an intelligent agent that plays spades and fixed game,it consists on finding a $4-digit$ number with no repeated digits, just by informing the amount of spades(digits that are in the number but not in the same position) and the amounts of fixed(digits that are in the number in the same position) for each question.

For example, the chosen number is $4096$.

  1. The agent asks for $1234$, $spades = 1$ $fixed = 0$
  2. The agent asks for $5678$,$spades = 1$ $fixed = 0$
  3. The agent asks for $9012$, $spades = 1$ $fixed = 1$

And so on until the number is found.

I'm working with an array that has all the possible $4-digit$ numbers and starts deleting the numbers containing discarded digits, but it takes a lot of questions more than just six because I have to check digit by digit and it takes up to 4 questions to discard one of them.

Any idea or help will be greatly appreciated, thank you for taking the time to read my question.