Mastermind Cheater
Mastermind is a code-breaking board game for two players. One player, the codemaker sets a combination of 6 possible colours on 4 pegs. The other player, the codebreaker tries to guess the code by placing a combination on the gameboard. The codemaker checks this guess with the code and places white or orange pegs. An orange peg means there is a peg with the right colour on the right place, a white peg means there is a peg with the right colour, but not on the right place. The codebreaker uses this information to get closer to the correct combination.
The app works as the codebreaker. Play the combinations the app gives, then enter the amount of orange and white pegs for this combination.
How it works
The app uses Donald Knuths algorithm:
- It creates a set of all 1296 combinations.
- For each guess, it iterates over each combination and removes every combination that does not give the same response if the guess was the code.
- Optionally the code looks for the combination that will eliminate the most combination.
- It keeps doing this until there is only one combination left.
This app was created with Cordova and AngularJS for Android as a way to look into OOP for AngularJS.
Links
Cordova/Phonegap
AngularJS
Bootstrap
Mastermind wikipedia article