Crack the Code: Find the Optimal Strategy

  • Context: High School 
  • Thread starter Thread starter 0rthodontist
  • Start date Start date
  • Tags Tags
    Code Crack Strategy
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
Science Advisor
Messages
1,229
Reaction score
0
There's a funny flash game where one of the puzzles is to guess a four-digit password with digits from 1 to 8. After each guess, the puzzle gives you some number of x's and some number of o's, with the x's indicating how many numbers you guessed correctly and in the right place, and the o's indicating how many numbers you guessed were correct but in the wrong place. Incidentally, you get nine guesses to find the password. Is there a simple optimal strategy for this?

Also no digits appear more than once in the password and you can't guess a password with digits appearing more than once.
 
Last edited:
Mathematics news on Phys.org
You might try looking up strategies for Mastermind, it's very similar. In mastermind you have only 6 choices for the digits (colours actually) and repetitions are allowed. Mastermind can apparently be done in 5 guesses.