Mastermind
My Mastermind, originally a C# console game: guess the secret number, and after every guess you learn how many digits are right and how many are in the right place. For this page I ported the same checking logic to TypeScript and added three levels, a daily puzzle and a mode where the computer guesses your number.
A new random number every game. The first digit is never 0, but digits can repeat.
How it works
The check runs in two passes, as in the original. First, digits in the right place are counted and crossed out in both numbers. Then every remaining digit of the guess is looked for among the remaining digits of the secret, and crossed out when found. Without crossing out, the guess 111 against the secret 123 would count three correct digits instead of one.
The computer uses the same check. On Expert it starts with 9 million possible numbers. After every answer it keeps only the numbers that would have given exactly the same answers to all its guesses so far, and picks one of them. In my tests it needed about 6 guesses on Novice and about 8 on Expert.