How to solve the "Mastermind" guessing game? (2009)
stackoverflow.com
How to solve the "Mastermind" guessing game? (2009)
1–10 of 33 posts
Re: How to solve the "Mastermind" guessing game? (2009)
#2Re: How to solve the "Mastermind" guessing game? (2009)
#3I've seen a lot of algorithms for how to play this, Donal Knuth has one that can win in 5 moves, but none that are really usable by humans. The method I use, which seems to always win is:
Guess 1111
Depending how many 1's were right, Guess 1222, 1122, 1112, 2222
Continue in this manor until the solution is found.
I just played this game ID: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/gues...
where it worked perfectly:
RRRR -> (1, 0) One red, somewhere.
RYYY -> (0, 1) No yellows, red is not first
GRGG -> (0, 2) One green in the 2nd position, red is 3 or 4.
BGRB -> (1, 1) No blues, red must be last.
OGOR -> (4, 0) Success.
Have been meaning to simulate this and see if there are any games where this method would not work. Sometimes it takes all the moves but I've never lost.
Re: How to solve the "Mastermind" guessing game? (2009)
#4This game is part of the Simon Tatham's Puzzle collection as "Guess" ( https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/gues... ) I've seen a lot of algorithms for how to play this, Donal Knuth has one that can win in 5 moves, but none that are really usable by humans. The method I use, which seems to always win is: Guess 1111 Depending how many 1's were right, Guess 1222, 1122, 1112, 2222 Continue in this man…
It's not foolproof (it can get tricky if you're unlucky finding the location of pegs) but it's a very easy algorithm to remember and implement.
Re: How to solve the "Mastermind" guessing game? (2009)
#5This game is part of the Simon Tatham's Puzzle collection as "Guess" ( https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/gues... ) I've seen a lot of algorithms for how to play this, Donal Knuth has one that can win in 5 moves, but none that are really usable by humans. The method I use, which seems to always win is: Guess 1111 Depending how many 1's were right, Guess 1222, 1122, 1112, 2222 Continue in this man…
On Android the free app "Simon Tatham's Puzzles" has an implementation of Mastermind and this is the same algorithm I use to solve it. It's not foolproof (it can get tricky if you're unlucky finding the location of pegs) but it's a very easy algorithm to remember and implement.
Re: How to solve the "Mastermind" guessing game? (2009)
#6This game is part of the Simon Tatham's Puzzle collection as "Guess" ( https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/gues... ) I've seen a lot of algorithms for how to play this, Donal Knuth has one that can win in 5 moves, but none that are really usable by humans. The method I use, which seems to always win is: Guess 1111 Depending how many 1's were right, Guess 1222, 1122, 1112, 2222 Continue in this man…
On Android the free app "Simon Tatham's Puzzles" has an implementation of Mastermind and this is the same algorithm I use to solve it. It's not foolproof (it can get tricky if you're unlucky finding the location of pegs) but it's a very easy algorithm to remember and implement.
Re: How to solve the "Mastermind" guessing game? (2009)
#7Re: How to solve the "Mastermind" guessing game? (2009)
#8This game is part of the Simon Tatham's Puzzle collection as "Guess" ( https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/gues... ) I've seen a lot of algorithms for how to play this, Donal Knuth has one that can win in 5 moves, but none that are really usable by humans. The method I use, which seems to always win is: Guess 1111 Depending how many 1's were right, Guess 1222, 1122, 1112, 2222 Continue in this man…
Re: How to solve the "Mastermind" guessing game? (2009)
#9ICYMI, 3blue1brown (Grant Sanderson) has a video applying information theory to solving Wordle, which is conceptually similar to mastermind -- https://www.youtube.com/watch?v=v68zYyaEmEA
Re: How to solve the "Mastermind" guessing game? (2009)
#10its a no hidden state turn game. so minimax. but state space is small. so render a table of all correct moves.