Interesting Problem/Puzzle/Game

ok here is the game:
your opponent has a secret number that is 4 digits long. the digits are 0-9 and no digit can be repeated in the number (in other words all 4 numbers are different)
examples: 1234, 1948, 4950
you have to guess the number
when you guess a number: your opponent gives you back 2 numbers (x,y)
number x is the amount of numbers in the right place
number y is the amount of numbers right but in the wrong place
anyone have an algorithm to solve this problem using the 2 numbers given back?

Comment viewing options

Select your preferred way to display the comments and click 'Save settings' to activate your changes.

This problem Puzzle Game is v

This problem Puzzle Game is very interesting. It involves 2 players,it involves mind.. I have this game in my nokia 5310 and i play it with a opponent team and i always win the game..

The game is called Mastermind

The game is called Mastermind, and you can do worse than to read the following page and its references for various strategies.
http://www.cut-the-knot.org/ctk/Mastermind.shtml

The classic version uses only 6 colors (i.e. 0-5 instead of 0-9) and the optimal strategy for that averages about 4.34 guesses.

Jaap
Jaap's Puzzle Page: http://www.jaapsch.net/puzzles/