A and B are playing the game of bulls and cows. The rules of the game are as follows.
A selects a word with distinct letters and B has to find it. B is allowed a maximum of ten guesses. After every guess A tells B the number of Bulls and Cows in the word.
Bulls are letters which appear in the correct location, and cows are letters which appear, but not in their correct location
For example, if A selects a word BOLD while B guesses LOUD. Then A's reply would be 2 Bulls and 1 Cow.(O and D are in the correct place while L is not). Note that A only tells the number of Bulls and Cows. He does not tells which ones are cows and bulls.
A selected a six letter word. The game proceeded as follows:
1. FRIEND - 0 Bulls, 2 Cows
2. SQUARE - 0 Bulls, 2 Cows
3. GROUND - 0 Bulls, 3 Cows
4. FORMAT - 1 Bull, 0 Cows
5. TRAVEL - 1 Bull, 1 Cow
6. FORMAL - 0 Bulls, 0 Cows
7. FLIGHT - 2 Bulls, 0 Cows
8. SYMBOL - 0 Bulls, 1 Cow
9. FIGURE - 0 Bulls, 3 Cows
What is A's word?
(Assume that A's word is a valid English word and has 6 distinct letters.)
Since 6 has no bulls and cows, none of the letters in it are in A's word. So for 4, which is identical except for the T at the end and gets one bull, we know that the bull is the T as the last letter. Looking at 7, which has two bulls, we can see that one is the T at the end. Note that the I in the third position is also in the third position of FRIEND, which has no bulls, so I cannot be the other bull. F and L are off our list from FORMAL, so the other bull must be either G or H. Looking at 9, which has 3 cows, we know that the F, I, and R are not those cows because we have eliminated those letters, so G, U, and E are cows. This means G was the other bull in FLIGHT. So far then we have xxxGxT, and U and E are also present in the word somewhere. From 5, we know that E is the letter between the G and T since in 5, E must be the bull, since T is a cow. From 1, since we know F, R, and I are not in the word and E is a cow, either N or D must be the other cow. From 2, U and E are the cows so we can eliminate the letters S and Q. From 8, since we know S,M,O, and L are eliminated, either Y or B must be the cow.
So we've got xxxGET with a U definitely in, either a B or Y, and either a N or D.
A few attempts gives "BUDGET" as the word.
|
Posted by Avin
on 2005-03-01 14:59:19 |