3 ms·
I saw this game (Mastermind or originally called Moo or Bulls and Cows) in an article in Software Practice and Experience[1] in the 70's. A couple of years late
by todd8 10y ago
I saw this game (Mastermind or originally called Moo or Bulls and Cows) in an article in Software Practice and Experience[1] in the 70's. A couple of years later I saw a very clear explanation of how to write an effective software opponent, written by Knuth[2]. It was a lot of fun to implement back in those days (first in Fortran and then in Pascal). I recommend the easy paper by Knuth.
It's surprising how effective Knuth's algorithm is. If I recall 4 or 5 guesses to solve 4 digit mastermind.
[1] Computer Recreations, Software – Practice & Experience 1.2, 201-204 (Apr-Jun 1971)
[2] D.E. Knuth, The Computer as Master Mind, J. Recreational Mathematics Vol. 9 (1976/7)
- taneq 10y agoThis is harder than Mastermind because you're not allowed to repeat colours/numbers in your entries. Interestingly, I find I'm using some similar logic to what I use playing Minesweeper. "Three of this quartet are in the pattern, one of this quartet is in the pattern, they overlap in two places, therefore the two non-overlapped points in the three-scoring quartet must be in the pattern." First try took 19 attempts, second try took 13 and I think I can do better.