Dead and Wounded!

the number guessing game...

HOW TO PLAY AND WIN


Dead and wounded is a game where you have to logically guess a random 4 digit secret number generated by the computer at the beginning of the game. The 4-digit number is formed from 0 to 9 with each digit appearing only once and the first digit not being "0". Make a guess to get started.

Winning The Game:

After you make a guess, the computer tells you how many of the numbers are dead(on the exact position) but doesn't tell you which of them is exactly and also tells you how many are wounded(in the set but not on the exact position). Using the information given back to you from the computer, you must logically guess (kill) the number in few moves as possible.
Example 1:
  • Secret number: 7098
  • Your guess: 7985
  • Response: one(1) dead and two(2) wounded. 7 is on the exact position so it's dead (one dead), while both 9 and 8 are in the secret number but are not in the right positions, thereby making them wounded (two wounded).
Example 2:
  • Secret number: 7098
  • Your guess: 1234
  • Response: zero(0) dead and zero(0) wounded. None of the numbers in your guess are part of the secret number, so none (0) dead and none (0) wounded.
Example 3:
  • Secret number: 7098
  • Your guess: 7098
  • Response: four(4) dead and zero(0) wounded. All numbers in the guess are in the secret number and in the right positions, so all (4) dead and none (0) wounded. You win at this point.
P.S: You have to figure out which numbers are dead and which are wounded by logically selecting your guesses.