Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro...
by foota on Wednesday April 26, 2017 @10:29PM
(#14208757)
Reminds me of a program I had to write earlier in school to implement an AI that would create hangman puzzles and then cheat on them by lying to the person playing, but in a way that they wouldn't contradict themselves and would have a valid word that matches what they've said so far.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro...
by celticninja on Thursday April 27, 2017 @06:01AM
(#14210365)
In this vein, finding where you get 0 dots can be very useful as well.
0 1 2
3 4 5
6 7 8
Then an L shaped pattern would be the string 0367.
The main idea is that you first build a list of every possible combination of legal moves. Then you take a random guess from that list and you will get back the number of white and black dots.
Now, since you know your random guess and the right answer produces X white dots and Y black dots, you can remove from the list of possible combinations every combination that has: dots(myGuess, combinations[i]) != (X, Y)
you can keep taking random guesses from this list and filtering after each attempt until you get the right answer, I'm not sure of the math but I think worst case It'll be 6-7 moves to find the right answer.