Cracking code with clues
Your problem is a variant of Mastermind. In particular, it is "Super Mastermind". Wikipedia contains some relevant pointers, and you can find many more by searching for Super Mastermind. For example, Temporel and Kovacs describes a heuristic algorithm that solves Super Mastermind using roughly 5–7 guesses. The same work also contains pointers to other algorithms.