3 ms·
Ask HN: 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 3y agoLacking 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”
- mdp2021 3y ago> go through all possible solutions, remove those inconsistent with the answers given so far Sure: you iterate suppositions "if that colour were in that place, then <consequences>, would they be consistent with each row?" and you restrict possibilities via the absurd (inconsistent) results of said question instances. But I was wondering if there were a Bayesian (probabilistic) way to frame the problem.
- Someone 3y agoIf you were wondering that, why don’t you tell us? We can’t read your mind (http://www.catb.org/~esr/faqs/smart-questions.html#beprecise http://www.catb.org/~esr/faqs/smart-questions.html#beprecise) I think even “is there a Bayesian (probabilistic) way to frame the problem?” isn’t precise enough. Firstly, what is the problem? Also, even assuming you mean state, not frame I wouldn’t know how to state a problem in a Bayesian way.
- mdp2021 3y ago> why don’t you tell us Well, I wrote «How would you compute the probabilities of each colour per position». It is not a real world problem with properties such as "being pressing" or of "specificity": it is just that I was wondering if Mastermind could be treated probabilistically, i.e. defining the probability of colour X being in position Y given a set of game "hints" (i.e. statements in the form "colours+positions configuration A has n correct placements and m correct colours"). The context remained "intellectual curiosity" - not really "help me solve a problem"; HN, not StackOverflow. The Bayesian perspective is the one that seemed possible and interesting: "can we define the probability of colour C in position P given a sequence of "hints", row by row"? The whole point is seeing if some interesting method comes up. Without too many constraints. It is leisure, with the possibility of gaining some new intellectual key. The non-detailed expression was meant to keep the problem open (to any interesting proposal). > state, not frame No, I meant "frame", as in: can the problem (of defining probabilities of colour per position in a Mastermind game given some previous game "hints") be solved within a Bayesian framework - i.e. one updating the probabilities of epistemic states given priors and new evidence.
- kens 3y agoI'd use brute force, since there aren't that many possibilities.
- mdp2021 3y ago> brute force But that does not really fit with the intellectual challenge :)
- kens 3y agoBut it's a programming challenge :-) My quick Python program gets 4 solutions out of 1296 possibilities: ['RGBY', 'GRYB', 'BYRG', 'YBGR'] So the answer is that each position has 25% chance of the four colors R, G, B, Y and 0% chance of the other two colors.
- cenazoic 3y agoGood discussion here: https://mathworld.wolfram.com/Mastermind.html https://mathworld.wolfram.com/Mastermind.html