Get the latest tech news
Using information theory to solve Mastermind
I have chosen a secret code. Try to guess it! How you've just played optimal Mastermind Mastermind is a game all about information.
The convention in information theory, a branch of mathematics and computer science dealing with just this type of question, is to define the information\(I\) provided by this guess and response as \[ I := \log_2 \frac{n}{n'}. Take the last significant digit with a grain of salt; there are usually many guesses with equal entropy, of which the program chooses one arbitrarily. For starters, the amount of information needed to narrow all \(n\) possible codes down to one is \(\log_2 n\) bits; this is displayed next to the number of possible moves.
Or read this on Hacker News