Mastermind game simulator and solver in Python.
1. To learn how to play Mastermind board game and its variants: https://en.wikipedia.org/wiki/Mastermind_(board_game)
code maker set to: ['green', 'blue', 'green', 'white']
code breaker start cracking:
attempt 1: ['red', 'blue', 'green', 'white'], key pegs: {'black': 3, 'white': 0}
attempt 2: ['red', 'blue', 'green', 'red'], key pegs: {'black': 2, 'white': 0}
attempt 3: ['red', 'white', 'green', 'white'], key pegs: {'black': 2, 'white': 0}
attempt 4: ['red', 'blue', 'yellow', 'white'], key pegs: {'black': 2, 'white': 0}
attempt 5: ['black', 'blue', 'green', 'white'], key pegs: {'black': 3, 'white': 0}
attempt 6: ['blue', 'blue', 'green', 'white'], key pegs: {'black': 3, 'white': 0}
attempt 7: ['green', 'blue', 'green', 'white'], key pegs: {'black': 4, 'white': 0}
solution reached after 7th attempt
attempt 1: ['red', 'white', 'white', 'green']
num of black pegs:2
num of white pegs:1
attempt 2: ['white', 'green', 'white', 'green']
...