HACKER Q&A
📣 mdp2021

How would you compute probabilities in this Mastermind game?


Suppose you have a Mastermind game which returned, for five times, "one in the right position, three in the wrong position" for the following configurations:

  RYGB
  RBYG
  GBRY
  YRBG
  BGYR
https://ibb.co/M2rg3k8

How would you compute the probabilities of each colour per position?


  👤 Someone Accepted Answer ✓
Lacking other information (e.g. you might have a model for what problems your opponent picks) I think the only sensible way is to go through all possible solutions, remove those inconsistent with the answers given so far, and assign equal probability to all of the remaining.

From a (somewhat) cursory look, that gives each of these a 25% probability:

  BYRG
  GRYB
  RGBY
  YBGR
More interesting is optimizing the best way forward. In general, that depends on what your goal is. typical ones are “minimize expected number of guesses” and “minimize worst-case number of guesses”

👤 cenazoic

👤 kens
I'd use brute force, since there aren't that many possibilities.