“An Arduino version of the game Mastermind where you can try to guess the computer’s number or it can try and guess yours.
After looking at the Knights Tour puzzle which was based on the Krishna Lalith version, I was intrigued by another one of her projects which is her Mastermind Game. All the implementations I have seen in the past are where the computer picks a random number and the player must guess it. However in Krishna’s version, it is the computer that must guess the players number.
I decided to make my own version to run on an Arduino UNO. You can choose to have the computer guess your number or try and guess a random number that the computer generates. I used a similar 4x4 keyboard layout and replaced the 4 digit 7 segment display with a 1602 LCD display.
I couldn’t find a suitable algorithm even after scanning the Internet. Krishna’s version creates an array of all possible outcomes and basically uses brute force to try every possible outcome eliminating future guesses as it learns whether digits are present or not. My variant is basically the same. Rather than have an array of all possible outcomes, it stores the user’s results along with its guess in a history array and any derived rule in a rules array. The rules array gets applied to future guesses and the history array is used to determine new rules based on the user’s previous responses.”